1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

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
This commit is contained in:
Isaac Dunham 2015-03-07 17:43:58 +00:00 committed by Jon Trulson
parent 917343911e
commit 6c5bab0854

View file

@ -1,3 +1,4 @@
#!/bin/sh
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: lsb-dtlogin # Provides: lsb-dtlogin
# Required-Start: $all # Required-Start: $all
@ -8,38 +9,36 @@
# Description: Dtlogin # Description: Dtlogin
### END INIT INFO ### 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 case "$1" in
'start') 'start')
if [ -z "$(pgrep dtlogin)" ]; start
then
echo " * Starting dtlogin..."
export LANG=C
exec /usr/dt/bin/dtlogin
else
echo "DTlogin already running..."
exit 0
fi
;; ;;
'stop') 'stop')
if [ -z "$(pgrep dtlogin)" ]; stop
then
exit 0
else
echo " * Stopping dtlogin..."
killall /usr/dt/bin/dtlogin
fi
;; ;;
'restart') 'restart')
if [ -z "$(pgrep dtlogin)" ]; stop
then start
export LANG=C
exec /usr/dt/bin/dtlogin
else
echo " * Restarting dtlogin..."
killall /usr/dt/bin/dtlogin
export LANG=C
exec /usr/dt/bin/dtlogin
fi
;; ;;
'status') 'status')
if [ -z "$(pgrep dtlogin)" ]; if [ -z "$(pgrep dtlogin)" ];