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

zmena exit statusu pro testu spustitelnosti; zmena nazvu funkci

parent 23e3eebe
No related branches found
No related tags found
No related merge requests found
...@@ -50,7 +50,7 @@ LOCK_FILE="/var/lock/warden-server" ...@@ -50,7 +50,7 @@ LOCK_FILE="/var/lock/warden-server"
SCRIPTNAME=`basename "$0"` SCRIPTNAME=`basename "$0"`
# check if daemon is present and executable # check if daemon is present and executable
test -x $DAEMON || exit 1 test -x $DAEMON || exit 0
if [ $UID -ne 0 ]; then if [ $UID -ne 0 ]; then
echo "You must be root for runnnig this script!" echo "You must be root for runnnig this script!"
...@@ -63,7 +63,8 @@ usage() { ...@@ -63,7 +63,8 @@ usage() {
} }
check_status() { check_status() {
if /bin/ps axo pid,comm | grep -q "warden-server*"; then /bin/ps axo pid,comm | grep -q "warden-server*"; RET_VAL=`echo $?`
if [ $RET_VAL -eq 0 ]; then
STATUS=1 # true - warden is running STATUS=1 # true - warden is running
else else
STATUS=0 # false - warden is not running STATUS=0 # false - warden is not running
...@@ -75,7 +76,7 @@ get_pid() { ...@@ -75,7 +76,7 @@ get_pid() {
return $PID return $PID
} }
start() { warden_start() {
check_status check_status
if [ $STATUS -eq 1 ]; then if [ $STATUS -eq 1 ]; then
get_pid PID get_pid PID
...@@ -89,7 +90,7 @@ start() { ...@@ -89,7 +90,7 @@ start() {
fi fi
} }
stop() { warden_stop() {
check_status check_status
if [ $STATUS -eq 1 ]; then if [ $STATUS -eq 1 ]; then
logger -s "Stopping Warden server daemon ..." logger -s "Stopping Warden server daemon ..."
...@@ -106,7 +107,7 @@ stop() { ...@@ -106,7 +107,7 @@ stop() {
fi fi
} }
status() { warden_status() {
check_status check_status
if [ $STATUS -eq 1 ]; then if [ $STATUS -eq 1 ]; then
get_pid PID get_pid PID
...@@ -118,7 +119,7 @@ status() { ...@@ -118,7 +119,7 @@ status() {
fi fi
} }
force_stop() { warden_force_stop() {
check_status check_status
if [ $STATUS -eq 1 ]; then if [ $STATUS -eq 1 ]; then
logger -s "Force stopping Warden server daemon ..." logger -s "Force stopping Warden server daemon ..."
...@@ -135,16 +136,16 @@ force_stop() { ...@@ -135,16 +136,16 @@ force_stop() {
case $1 in case $1 in
status) status)
status warden_status
;; ;;
start) start)
start warden_start
;; ;;
stop) stop)
stop warden_stop
;; ;;
force-stop) force-stop)
force_stop warden_force_stop
;; ;;
restart) restart)
$0 stop $0 stop
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment