Files
cdesktop/cde/contrib/rc/linux/dtlogin
Isaac Dunham 6c5bab0854 contrib/rc/linux/dtlogin: Make the init script work.
* insserv requires a shebang line
* the rc script can hang if a daemon is started in the foreground
* "pgrep dtlogin" apparently can match the init script, if it is started
  with "service dtlogin start" or similar.
* reduce code duplication
2015-03-07 19:44:55 -07:00

58 lines
894 B
Bash

#!/bin/sh
### BEGIN INIT INFO
# Provides: lsb-dtlogin
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Dtlogin
# Description: Dtlogin
### END INIT INFO
export PATH="/usr/dt/bin:$PATH"
OPTIONS="-quiet -daemon"
start(){
if [ -z "$(pgrep /usr/dt/bin/dtlogin)" ];
then
echo " * Starting dtlogin..."
export LANG=C
/usr/dt/bin/dtlogin $OPTIONS
fi
}
stop(){
if [ -n "$(pgrep /usr/dt/bin/dtlogin)" ];
then
echo " * Stopping dtlogin..."
killall /usr/dt/bin/dtlogin
fi
}
case "$1" in
'start')
start
;;
'stop')
stop
;;
'restart')
stop
start
;;
'status')
if [ -z "$(pgrep dtlogin)" ];
then
echo "DTlogin is not currently running..."
exit 3
else
echo "DTlogin is running..." && echo "[ $(pidof dtlogin) ]"
exit 0
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 0
;;
esac