From 9d7f9d6253717dc5f87d674c1cc49f53256d9485 Mon Sep 17 00:00:00 2001 From: Arianit K Date: Tue, 3 Jun 2025 00:16:37 +0000 Subject: KISSmo Docker --- update_kissmo.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 update_kissmo.sh (limited to 'update_kissmo.sh') diff --git a/update_kissmo.sh b/update_kissmo.sh new file mode 100644 index 0000000..f6e0195 --- /dev/null +++ b/update_kissmo.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Script to update the KISSmo Perl repository and restart the application + +# Navigate to the application directory. Exit if the directory is not found. +cd /app || { echo "$(date): Error: /app directory not found. Aborting update." >> /var/log/cron.log; exit 1; } + +echo "$(date): Starting KISSmo Perl update..." >> /var/log/cron.log + +# Pull the latest changes from the Git repository +git pull +if [ $? -ne 0 ]; then + echo "$(date): Git pull failed. Aborting update." >> /var/log/cron.log + exit 1 +fi +echo "$(date): Git repository updated successfully." >> /var/log/cron.log + +# Find the PID of the running KISSmo Perl process and kill it. +# We use 'pgrep -f' to match the full command line of the perl process. +PIDS=$(pgrep -f "perl paste.pl daemon -m production -l http://0.0.0.0:7878") +if [ -n "$PIDS" ]; then + echo "$(date): Found running KISSmo Perl processes: $PIDS. Killing them..." >> /var/log/cron.log + kill $PIDS + # Give the process some time to shut down gracefully + sleep 5 +else + echo "$(date): No running KISSmo Perl processes found to kill." >> /var/log/cron.log +fi + +# Start the application again in daemon mode +echo "$(date): Restarting KISSmo Perl application..." >> /var/log/cron.log +perl paste.pl daemon -m production -l http://0.0.0.0:7878 +if [ $? -ne 0 ]; then + echo "$(date): Failed to restart KISSmo Perl application." >> /var/log/cron.log + exit 1 +fi +echo "$(date): KISSmo Perl restarted successfully." >> /var/log/cron.log -- cgit v1.2.3