Removed dependency on LSB - script should now work on generic UNIX and Linux distros without LSB
This commit is contained in:
parent
dd69712dc2
commit
077bf9e20c
@ -49,17 +49,37 @@
|
|||||||
# Description: The Guacamole proxy daemon, required to translate remote desktop protocols into the text-based Guacamole protocol used by the JavaScript application.
|
# Description: The Guacamole proxy daemon, required to translate remote desktop protocols into the text-based Guacamole protocol used by the JavaScript application.
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
# Source function library.
|
|
||||||
. /lib/lsb/init-functions
|
|
||||||
|
|
||||||
prog="guacd"
|
prog="guacd"
|
||||||
exec="@sbindir@/$prog"
|
exec="@sbindir@/$prog"
|
||||||
pidfile="/var/run/$prog.pid"
|
pidfile="/var/run/$prog.pid"
|
||||||
|
|
||||||
|
# Returns PID of currently running process, if any
|
||||||
|
getpid() {
|
||||||
|
|
||||||
|
if [ -f "$pidfile" ]
|
||||||
|
then
|
||||||
|
|
||||||
|
read PID < "$pidfile"
|
||||||
|
|
||||||
|
# If pidfile contains PID and PID is valid
|
||||||
|
if [ -n "$PID" ] && ps "$PID" > /dev/null 2>&1
|
||||||
|
then
|
||||||
|
echo "$PID"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# pidfile/pid not found, or process is dead
|
||||||
|
return 1
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
[ -x $exec ] || exit 5
|
[ -x $exec ] || exit 5
|
||||||
echo -n "Starting $prog: "
|
echo -n "Starting $prog: "
|
||||||
start_daemon -p "$pidfile" $exec -p "$pidfile"
|
|
||||||
|
getpid > /dev/null || $exec -p "$pidfile"
|
||||||
retval=$?
|
retval=$?
|
||||||
|
|
||||||
case "$retval" in
|
case "$retval" in
|
||||||
@ -76,24 +96,31 @@ start() {
|
|||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
echo -n "Stopping $prog: "
|
echo -n "Stopping $prog: "
|
||||||
killproc -p "$pidfile" $prog
|
|
||||||
|
PID=`getpid`
|
||||||
retval=$?
|
retval=$?
|
||||||
|
|
||||||
case "$retval" in
|
case "$retval" in
|
||||||
0)
|
0)
|
||||||
|
if kill $PID > /dev/null 2>&1
|
||||||
|
then
|
||||||
echo "SUCCESS"
|
echo "SUCCESS"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "FAIL"
|
||||||
|
return 1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "FAIL"
|
echo "SUCCESS (not running)"
|
||||||
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
return $retval
|
|
||||||
}
|
}
|
||||||
|
|
||||||
restart() {
|
restart() {
|
||||||
stop
|
stop && start
|
||||||
start
|
|
||||||
}
|
}
|
||||||
|
|
||||||
force_reload() {
|
force_reload() {
|
||||||
@ -102,7 +129,7 @@ force_reload() {
|
|||||||
|
|
||||||
status() {
|
status() {
|
||||||
|
|
||||||
PID=`pidofproc -p "$pidfile" $prog`
|
PID=`getpid`
|
||||||
retval=$?
|
retval=$?
|
||||||
|
|
||||||
case "$retval" in
|
case "$retval" in
|
||||||
|
Loading…
Reference in New Issue
Block a user