added scheduler to init script
This commit is contained in:
parent
69bb7691bc
commit
3c48ba6420
1 changed files with 12 additions and 0 deletions
|
@ -15,10 +15,12 @@ APP_ROOT="/home/zammad/zammad"
|
||||||
PID_PATH="$APP_ROOT/tmp/pids"
|
PID_PATH="$APP_ROOT/tmp/pids"
|
||||||
WEB_SERVER_PID="$PID_PATH/puma.pid"
|
WEB_SERVER_PID="$PID_PATH/puma.pid"
|
||||||
WEBSOCKET_SERVER_PID="$PID_PATH/websocket.pid"
|
WEBSOCKET_SERVER_PID="$PID_PATH/websocket.pid"
|
||||||
|
SCHEDULER_SERVER_PID="$PID_PATH/websocket.pid"
|
||||||
|
|
||||||
APP_USER="zammad"
|
APP_USER="zammad"
|
||||||
PUMA_OPTS="-p 3000 -d -e production --pidfile $WEB_SERVER_PID"
|
PUMA_OPTS="-p 3000 -d -e production --pidfile $WEB_SERVER_PID"
|
||||||
WEBSOCKET_OPTS="-d"
|
WEBSOCKET_OPTS="-d"
|
||||||
|
SCHEDULER_OPTS=""
|
||||||
|
|
||||||
NAME="zammad"
|
NAME="zammad"
|
||||||
DESC="Zammad application"
|
DESC="Zammad application"
|
||||||
|
@ -37,6 +39,12 @@ check_daemons() {
|
||||||
WEBSOCKET_PID=$(pgrep -F $WEBSOCKET_SERVER_PID)
|
WEBSOCKET_PID=$(pgrep -F $WEBSOCKET_SERVER_PID)
|
||||||
WEBSOCKET_OK=$?
|
WEBSOCKET_OK=$?
|
||||||
fi
|
fi
|
||||||
|
SCHEDULER_PID=1
|
||||||
|
SCHEDULER_OK=1
|
||||||
|
if [ -f $SCHEDULER_SERVER_PID ]; then
|
||||||
|
SCHEDULER_PID=$(pgrep -F $SCHEDULER_SERVER_PID)
|
||||||
|
SCHEDULER_OK=$?
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
execute() {
|
execute() {
|
||||||
|
@ -56,6 +64,7 @@ start() {
|
||||||
else
|
else
|
||||||
execute "RAILS_ENV=production script/websocket-server.rb start $WEBSOCKET_OPTS"
|
execute "RAILS_ENV=production script/websocket-server.rb start $WEBSOCKET_OPTS"
|
||||||
fi
|
fi
|
||||||
|
execute "RAILS_ENV=production script/scheduler.rb start $SCHEDULER_OPTS"
|
||||||
echo "$DESC started"
|
echo "$DESC started"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +81,7 @@ stop() {
|
||||||
execute "RAILS_ENV=production script/websocket-server.rb stop $WEBSOCKET_OPTS"
|
execute "RAILS_ENV=production script/websocket-server.rb stop $WEBSOCKET_OPTS"
|
||||||
test -f "$WEBSOCKET_SERVER_PID" && rm -f "$WEBSOCKET_SERVER_PID"
|
test -f "$WEBSOCKET_SERVER_PID" && rm -f "$WEBSOCKET_SERVER_PID"
|
||||||
fi
|
fi
|
||||||
|
execute "RAILS_ENV=production script/scheduler.rb stop $SCHEDULER_OPTS"
|
||||||
echo "$DESC stopped"
|
echo "$DESC stopped"
|
||||||
else
|
else
|
||||||
## Program is not running, exit with error.
|
## Program is not running, exit with error.
|
||||||
|
@ -88,6 +98,7 @@ restart() {
|
||||||
kill -USR2 $PUMA_PID
|
kill -USR2 $PUMA_PID
|
||||||
execute "RAILS_ENV=production script/websocket-server.rb stop $WEBSOCKET_OPTS"
|
execute "RAILS_ENV=production script/websocket-server.rb stop $WEBSOCKET_OPTS"
|
||||||
execute "RAILS_ENV=production script/websocket-server.rb start $WEBSOCKET_OPTS"
|
execute "RAILS_ENV=production script/websocket-server.rb start $WEBSOCKET_OPTS"
|
||||||
|
execute "RAILS_ENV=production script/scheduler.rb restart $SCHEDULER_OPTS"
|
||||||
echo "$DESC restarted."
|
echo "$DESC restarted."
|
||||||
else
|
else
|
||||||
echo "Error, $NAME not running!"
|
echo "Error, $NAME not running!"
|
||||||
|
@ -108,6 +119,7 @@ status() {
|
||||||
else
|
else
|
||||||
echo "Websocket server (pid $WEBSOCKET_PID) is not running."
|
echo "Websocket server (pid $WEBSOCKET_PID) is not running."
|
||||||
fi
|
fi
|
||||||
|
execute "RAILS_ENV=production script/scheduler.rb status $SCHEDULER_OPTS"
|
||||||
}
|
}
|
||||||
|
|
||||||
## Check to see if we are running as root first.
|
## Check to see if we are running as root first.
|
||||||
|
|
Loading…
Reference in a new issue