1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/movim_ynh.git synced 2024-09-03 19:46:19 +02:00

[fix] Use stronger systemd check and be quiet

This commit is contained in:
Jérôme Lebleu 2016-07-10 18:31:45 +02:00
parent 5decd0dd65
commit aebd4ba52d
3 changed files with 38 additions and 39 deletions

View file

@ -101,15 +101,14 @@ exec_cmd php mud.php config --loglevel=1 \
--username="$admin" --password="$password"
# Copy init script or systemd service
sudo sed -i "s@YHURL@$domain$path@g" ../conf/movim.{service,init}
sudo sed -i "s@YHDIR@$DESTDIR@g" ../conf/movim.{service,init}
sudo sed -i "s@YHPORT@$port@g" ../conf/movim.{service,init}
initcheck=`pgrep -ox systemd`
if [ "$initcheck" = "1" ];
then
sudo sed -i "s@YHURL@${domain}${path}@g" ../conf/movim.{service,init}
sudo sed -i "s@YHDIR@${DESTDIR}@g" ../conf/movim.{service,init}
sudo sed -i "s@YHPORT@${port}@g" ../conf/movim.{service,init}
if [ -d /run/systemd/system ]; then
sudo cp ../conf/movim.service /etc/systemd/system/
sudo systemctl enable movim.service
sudo systemctl start movim.service
sudo systemctl --quiet daemon-reload
sudo systemctl --quiet enable movim.service
sudo systemctl --quiet start movim.service
else
sudo cp ../conf/movim.init /etc/init.d/movim
sudo chmod 755 /etc/init.d/movim
@ -137,6 +136,6 @@ else
apply_sso_patch
fi
# Start Movim
# Reload services
sudo service php5-fpm restart
sudo service nginx reload

View file

@ -8,14 +8,16 @@ source /usr/share/yunohost/helpers
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
# Stop service and remove init
sudo service php5-fpm stop
sudo /etc/init.d/movim stop
sudo systemctl stop movim.service
sudo systemctl disable movim.service
# Stop service and remove it
sudo service movim stop
if [ -d /run/systemd/system ]; then
sudo systemctl --quiet disable movim.service
sudo rm -f /lib/systemd/system/movim.service
sudo systemctl --quiet daemon-reload
else
sudo update-rc.d -f movim remove
sudo rm -f /etc/init.d/movim
sudo rm -f /lib/systemd/system/movim.service
fi
# Drop MySQL database and user
db_user=movim
@ -32,6 +34,6 @@ sudo rm -rf /var/www/movim
sudo rm -f /etc/nginx/conf.d/$domain.d/movim.conf
sudo rm -f /etc/php5/fpm/pool.d/movim.conf
# Restarting services
# Reload services
sudo service nginx reload
sudo service php5-fpm start
sudo service php5-fpm restart

View file

@ -70,15 +70,13 @@ else
fi
# Update init scripts
sudo sed -i "s@YHURL@$domain$path@g" ../conf/movim.{service,init}
sudo sed -i "s@YHDIR@$DESTDIR@g" ../conf/movim.{service,init}
sudo sed -i "s@YHPORT@$port@g" ../conf/movim.{service,init}
initcheck=`pgrep -ox systemd`
if [ "$initcheck" = "1" ];
then
sudo sed -i "s@YHURL@${domain}${path}@g" ../conf/movim.{service,init}
sudo sed -i "s@YHDIR@${DESTDIR}@g" ../conf/movim.{service,init}
sudo sed -i "s@YHPORT@${port}@g" ../conf/movim.{service,init}
if [ -d /run/systemd/system ]; then
sudo rm -f /lib/systemd/system/movim.service
sudo cp ../conf/movim.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl --quiet daemon-reload
else
sudo /etc/init.d/movim stop
sudo cp ../conf/movim.init /etc/init.d/movim
@ -98,7 +96,7 @@ sed -i "s@YHPORT@$port@g" ../conf/nginx.conf
sed -i "s@//ws/@/ws/@g" ../conf/nginx.conf # Avoid duplicate /
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/movim.conf
# Reload
# Reload services
sudo service movim restart
sudo service php5-fpm restart
sudo service nginx reload