aboutsummaryrefslogtreecommitdiffstats
path: root/update_kissmo.sh
diff options
context:
space:
mode:
authorArianit K <arianit@hax.al>2025-06-03 00:16:37 +0000
committerArianit K <arianit@hax.al>2025-06-03 00:16:37 +0000
commit9d7f9d6253717dc5f87d674c1cc49f53256d9485 (patch)
tree8ab3b154b462e696ce2ab34fb00af622e23365be /update_kissmo.sh
downloadKISSmoDocker-9d7f9d6253717dc5f87d674c1cc49f53256d9485.tar.gz
KISSmoDocker-9d7f9d6253717dc5f87d674c1cc49f53256d9485.zip
KISSmo Docker
Diffstat (limited to 'update_kissmo.sh')
-rw-r--r--update_kissmo.sh36
1 files changed, 36 insertions, 0 deletions
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