xgit simple git

KISSmoDocker

KISSmo Docker setup

clone git clone https://kb.hax.al/KISSmoDocker

update_kissmo.sh


1#!/bin/bash
2# Script to update the KISSmo Perl repository and restart the application
3 
4# Navigate to the application directory. Exit if the directory is not found.
5cd /app || { echo "$(date): Error: /app directory not found. Aborting update." >> /var/log/cron.log; exit 1; }
6 
7echo "$(date): Starting KISSmo Perl update..." >> /var/log/cron.log
8 
9# Pull the latest changes from the Git repository
10git pull
11if [ $? -ne 0 ]; then
12    echo "$(date): Git pull failed. Aborting update." >> /var/log/cron.log
13    exit 1
14fi
15echo "$(date): Git repository updated successfully." >> /var/log/cron.log
16 
17# Find the PID of the running KISSmo Perl process and kill it.
18# We use 'pgrep -f' to match the full command line of the perl process.
19PIDS=$(pgrep -f "perl paste.pl daemon -m production -l http://0.0.0.0:7878")
20if [ -n "$PIDS" ]; then
21    echo "$(date): Found running KISSmo Perl processes: $PIDS. Killing them..." >> /var/log/cron.log
22    kill $PIDS
23    # Give the process some time to shut down gracefully
24    sleep 5
25else
26    echo "$(date): No running KISSmo Perl processes found to kill." >> /var/log/cron.log
27fi
28 
29# Start the application again in daemon mode
30echo "$(date): Restarting KISSmo Perl application..." >> /var/log/cron.log
31perl paste.pl daemon -m production -l http://0.0.0.0:7878
32if [ $? -ne 0 ]; then
33    echo "$(date): Failed to restart KISSmo Perl application." >> /var/log/cron.log
34    exit 1
35fi
36echo "$(date): KISSmo Perl restarted successfully." >> /var/log/cron.log