Skip to content

Commit

Permalink
Version 0.9.57
Browse files Browse the repository at this point in the history
- Fix PID file issue where another process may be assigned our old PID after an unclean shutdown.
- Bump pixl-server to v1.0.44 for same reason.
- Fixes #789
  • Loading branch information
jhuckaby committed Aug 1, 2024
1 parent 08b1288 commit 26aded4
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 119 deletions.
77 changes: 43 additions & 34 deletions bin/control.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
PATH=$PATH:/usr/bin:/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin
#
# the name of your binary
NAME="Cronicle Daemon"
NAME="Cronicle Server"
#
# home directory
HOMEDIR="$(dirname "$(cd -- "$(dirname "$0")" && (pwd -P 2>/dev/null || pwd))")"
Expand All @@ -40,60 +40,69 @@ PIDFILE=$HOMEDIR/logs/cronicled.pid
ERROR=0
ARGV="$@"
if [ "x$ARGV" = "x" ] ; then
ARGS="help"
ARGS="help"
fi

for ARG in $@ $ARGS
do
# check for pidfile
if [ -f $PIDFILE ] ; then
# check for pidfile
if [ -f $PIDFILE ] ; then
PID=`cat $PIDFILE`
if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
STATUS="$NAME running (pid $PID)"
RUNNING=1
if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
# make sure process is actually ours
PS=`ps -p $PID -o args= | sed 's/[ \t]*$//'`

if [ "$PS" = "$NAME" ] ; then
STATUS="$NAME running (pid $PID)"
RUNNING=1
else
STATUS="$NAME not running (pid $PID?)"
RUNNING=0
fi

else
STATUS="$NAME not running (pid $PID?)"
RUNNING=0
fi
else
STATUS="$NAME not running (pid $PID?)"
RUNNING=0
fi
else
STATUS="$NAME not running (no pid file)"
RUNNING=0
fi
fi

case $ARG in
start)
case $ARG in
start)
if [ $RUNNING -eq 1 ]; then
echo "$ARG: $NAME already running (pid $PID)"
continue
echo "$ARG: $NAME already running (pid $PID)"
continue
fi
echo "$0 $ARG: Starting up $NAME..."
if $BINARY ; then
echo "$0 $ARG: $NAME started"
echo "$0 $ARG: $NAME started"
else
echo "$0 $ARG: $NAME could not be started"
ERROR=3
echo "$0 $ARG: $NAME could not be started"
ERROR=3
fi
;;
stop)
stop)
if [ $RUNNING -eq 0 ]; then
echo "$ARG: $STATUS"
continue
echo "$ARG: $STATUS"
continue
fi
if kill $PID ; then
while [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; do
sleep 1;
done
echo "$0 $ARG: $NAME stopped"
while [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; do
sleep 1;
done
echo "$0 $ARG: $NAME stopped"
else
echo "$0 $ARG: $NAME could not be stopped"
ERROR=4
echo "$0 $ARG: $NAME could not be stopped"
ERROR=4
fi
;;
restart)
$0 stop start
restart)
$0 stop start
;;
cycle)
$0 stop start
cycle)
$0 stop start
;;
status)
echo "$ARG: $STATUS"
Expand All @@ -116,7 +125,7 @@ do
;;
import)
if [ $RUNNING -eq 1 ]; then
$0 stop
$0 stop
fi
node $HOMEDIR/bin/storage-cli.js import $2 $3 $4
exit
Expand All @@ -134,7 +143,7 @@ do
echo "$PACKAGE_VERSION"
exit
;;
*)
*)
echo "usage: $0 (start|stop|cycle|status|setup|maint|admin|export|import|upgrade|help)"
cat <<EOF
Expand Down
109 changes: 26 additions & 83 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Cronicle",
"version": "0.9.56",
"version": "0.9.57",
"description": "A simple, distributed task scheduler and runner with a web based UI.",
"author": "Joseph Huckaby <jhuckaby@gmail.com>",
"homepage": "https://github.com/jhuckaby/Cronicle",
Expand Down Expand Up @@ -48,7 +48,7 @@
"pixl-mail": "^1.0.14",
"pixl-perf": "^1.0.5",
"pixl-request": "^2.0.1",
"pixl-server": "^1.0.39",
"pixl-server": "^1.0.44",
"pixl-server-api": "^1.0.2",
"pixl-server-storage": "^3.1.18",
"pixl-server-user": "^1.0.22",
Expand Down

0 comments on commit 26aded4

Please sign in to comment.