Skip to content
Snippets Groups Projects
Commit 0990b1f6 authored by Tomáš Plesník's avatar Tomáš Plesník
Browse files

skript prepsan do jednotlivych funkci; mezi stopnutim a startem serveru pri...

skript prepsan do jednotlivych funkci; mezi stopnutim a startem serveru pri restartu pridano 1s cekani
parent 8789ffd7
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,6 @@
# otherwise) arising in any way out of the use of this software, even
# if advised of the possibility of such damage.
WARDEN="/opt/warden-server/bin/warden-server.pl"
PID_FILE="/var/run/warden-server.pl.pid"
LOCK_FILE="/var/lock/warden-server"
......@@ -47,6 +46,12 @@ if [ -z $WARDEN ]; then
exit 1
fi
usage() {
echo "Usage: $0 [start|stop|status|restart|force-stop]"
exit 1
}
check_status() {
/bin/ps axo pid,comm | grep -q "warden-server*"; RET_VAL=`echo $?`
if [ $RET_VAL -eq 0 ]; then
......@@ -61,17 +66,7 @@ get_pid() {
return $PID
}
case $1 in
status)
check_status
if [ $STATUS -eq 1 ]; then
get_pid PID
echo "Warden daemon is running (pid $PID)."
else
echo "Warden daemon is NOT running."
fi
;;
start)
warden_start() {
check_status
if [ $STATUS -eq 1 ]; then
get_pid PID
......@@ -81,8 +76,9 @@ case $1 in
$WARDEN
touch $LOCK_FILE
fi
;;
stop)
}
warden_stop() {
check_status
if [ $STATUS -eq 1 ]; then
echo "Stoping Warden server daemon ..."
......@@ -96,8 +92,19 @@ case $1 in
else
echo "Warden daemon is NOT running."
fi
;;
force-stop)
}
warden_status() {
check_status
if [ $STATUS -eq 1 ]; then
get_pid PID
echo "Warden daemon is running (pid $PID)."
else
echo "Warden daemon is NOT running."
fi
}
warden_force_stop() {
check_status
if [ $STATUS -eq 1 ]; then
echo "Force stoping Warden server daemon ..."
......@@ -110,15 +117,28 @@ case $1 in
else
echo "Warden daemon is NOT running."
fi
}
case $1 in
status)
warden_status
;;
start)
warden_start
;;
stop)
warden_stop
;;
force-stop)
warden_force_stop
;;
restart)
$0 stop
$0 start
warden_stop
sleep 1
warden_start
;;
*)
# Display usage of this script
echo "Usage: $0 [start|stop|status|restart|force-stop]"
exit 1
usage
;;
esac
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment