From 58bb04c672d5ade092534da26104537921aac519 Mon Sep 17 00:00:00 2001 From: Martin Winkler Date: Sat, 31 Dec 2022 09:01:51 +0100 Subject: [PATCH] friendica - stop service for upgrade and add notes --- seqs/friendica.sh | 52 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/seqs/friendica.sh b/seqs/friendica.sh index 6520d85..1eafc41 100755 --- a/seqs/friendica.sh +++ b/seqs/friendica.sh @@ -115,7 +115,7 @@ step_22() { exe tar -xf "$tempLoc" endReturn -o $? "Extract failed: $tempLoc" else - echo " [I] Found existing download: $tempExtract" + info "Found existing download: $tempExtract" fi if [ ! -e "$tempExtractAddons" ] ; then @@ -126,7 +126,7 @@ step_22() { exe tar -xC "${tempExtractAddons}" -f "$tempLocAddons" endReturn -o $? "Extract failed: $tempLocAddons" else - echo " [I] Found existing download: $tempExtractAddons" + info "Found existing download: $tempExtractAddons" fi # Installation @@ -136,13 +136,14 @@ step_22() { exe mv "$FR_LOC" "$tempBu" step backup "$tempBu" endReturn -o $? "Backup failed; $FR_LOC renamed!" - echo " [I] Installing version $latestVersion to $FR_LOC" + info "Installing version $latestVersion to $FR_LOC" + exe systemctl stop friendica.service exe mv "$tempExtract" "$FR_LOC" exe mv "$tempExtractAddons/addon" "$tempAddons" exe chown -R www-data: "$FR_LOC" # Configuration - echo " [I] Copying configuration" + info "Copying configuration" exe cp -ar "$tempBu/config/local.config.php" "$FR_LOC/config/" if [ -f "$tempBu/config/addon.config.php" ]; then exe cp -ar "$tempBu/config/addon.config.php" "$FR_LOC/config/" @@ -152,7 +153,8 @@ step_22() { exe cp -ar "$tempBu/home".* "$FR_LOC/" fi - echo " [I] Don't forget to \"clean\" if everything is working as expected" + exe systemctl stop friendica.service + info "Don't forget to \"clean\" if everything is working as expected" } tempDown="/tmp/friendica" tempLoc="$tempDown/fr.tar.gz" @@ -164,5 +166,45 @@ step_24() { exe rm -rf "$tempDown" } +step_40_info() { echo 'Notes'; } +step_40_alias() { echo 'notes'; } +step_40() { + color green + cat < [ + [...] + 'pidfile' => '/run/friendica/daemon.pid', + ], + +* Install Service file + +[Unit] +Description=Friendica Worker Daemon +After=network.target mariadb.service + +[Service] +Type=simple +Restart=always +User=www-data +Group=www-data +RuntimeDirectory=friendica +WorkingDirectory=${FR_LOC} +ExecStart=/usr/bin/php ./bin/daemon.php start +ExecStop=/usr/bin/php ./bin/daemon.php stop +PIDFile=friendica/daemon.pid + +[Install] +WantedBy=multi-user.target + + * RuntimeDirectory: creates a folder below \`/run\` +NOTES_END +} + +# shellcheck disable=SC2034 # Appears unused readonly sqr_minVersion=16 +# shellcheck disable=SC1091 # Don't follow this source . /usr/local/bin/sequencer.sh