diff --git a/conf/systemd.service b/conf/systemd.service index 7ab5b56..d2e974e 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -4,12 +4,10 @@ After=network.target mariadb.service Requires=network.target remote-fs.target nss-lookup.target [Service] +Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ -Type=simple -StandardOutput=append:/var/log/__APP__/daemon.log -StandardError=inherit ExecStart=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php start ExecStop=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php stop PIDFile=__INSTALL_DIR__/daemon.pid diff --git a/scripts/change_url b/scripts/change_url index c277451..666f181 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,6 +9,13 @@ source _common.sh source /usr/share/yunohost/helpers +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping $app's systemd service..." --weight=1 + +ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" + #================================================= # MODIFY URL IN NGINX CONF #================================================= @@ -25,6 +32,13 @@ ynh_print_info --message="Updating the Friendica config..." ynh_replace_string --match_string="'url' => 'https://.*'," --replace_string="'url' => 'https://$domain'," --target_file="$install_dir/config/local.config.php" ynh_store_file_checksum --file="$install_dir/config/local.config.php" +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting $app's systemd service..." --weight=1 + +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index e0db0a6..9f2a6d6 100644 --- a/scripts/install +++ b/scripts/install @@ -53,7 +53,7 @@ ynh_add_systemd_config --service="$app-daemon" # Create a dedicated nginx config ynh_add_nginx_config -yunohost service add "$app-daemon" --description="Friendica daemon" --log="/var/log/$app/daemon.log" +yunohost service add "$app-daemon" --description="Decentralized Social Network" --log="/var/log/$app/daemon.log" # Use logrotate to manage application logfile(s) ynh_use_logrotate @@ -90,7 +90,7 @@ popd #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="/var/log/$app/daemon.log" +ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index ecc27d9..9e4f1c1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -44,7 +44,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app-daemon.service" systemctl enable "$app-daemon.service" --quiet -yunohost service add "$app-daemon" --description="Friendica daemon" --log="/var/log/$app/daemon.log" +yunohost service add "$app-daemon" --description="Decentralized Social Network" --log="/var/log/$app/daemon.log" ynh_restore_file --origin_path="/var/log/$app" @@ -65,7 +65,7 @@ ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload ynh_systemd_action --service_name=nginx --action=reload -ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="/var/log/$app/daemon.log" +ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="systemd" #============== # FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index cda53dd..6fe56b6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name="$app-daemon" --action="stop" --log_path="/var/log/$app/daemon.log" +ynh_systemd_action --service_name="$app-daemon" --action="stop" --log_path="systemd" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -54,7 +54,7 @@ fi ynh_add_systemd_config --service="$app-daemon" -yunohost service add "$app-daemon" --description="Friendica daemon" --log="/var/log/$app/daemon.log" +yunohost service add "$app-daemon" --description="Decentralized Social Network" --log="/var/log/$app/daemon.log" # Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"\".*$" @@ -100,7 +100,7 @@ popd #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="/var/log/$app/daemon.log" +ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="systemd" #================================================= # END OF SCRIPT