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:
parent
917343911e
commit
6c5bab0854
1 changed files with 25 additions and 26 deletions
|
@ -1,3 +1,4 @@
|
|||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: lsb-dtlogin
|
||||
# Required-Start: $all
|
||||
|
@ -8,38 +9,36 @@
|
|||
# Description: Dtlogin
|
||||
### END INIT INFO
|
||||
|
||||
case "$1" in
|
||||
'start')
|
||||
if [ -z "$(pgrep dtlogin)" ];
|
||||
export PATH="/usr/dt/bin:$PATH"
|
||||
OPTIONS="-quiet -daemon"
|
||||
|
||||
start(){
|
||||
if [ -z "$(pgrep /usr/dt/bin/dtlogin)" ];
|
||||
then
|
||||
echo " * Starting dtlogin..."
|
||||
export LANG=C
|
||||
exec /usr/dt/bin/dtlogin
|
||||
else
|
||||
echo "DTlogin already running..."
|
||||
exit 0
|
||||
/usr/dt/bin/dtlogin $OPTIONS
|
||||
fi
|
||||
;;
|
||||
'stop')
|
||||
if [ -z "$(pgrep dtlogin)" ];
|
||||
}
|
||||
|
||||
stop(){
|
||||
if [ -n "$(pgrep /usr/dt/bin/dtlogin)" ];
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
echo " * Stopping dtlogin..."
|
||||
killall /usr/dt/bin/dtlogin
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
'start')
|
||||
start
|
||||
;;
|
||||
'stop')
|
||||
stop
|
||||
;;
|
||||
'restart')
|
||||
if [ -z "$(pgrep dtlogin)" ];
|
||||
then
|
||||
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
|
||||
stop
|
||||
start
|
||||
;;
|
||||
'status')
|
||||
if [ -z "$(pgrep dtlogin)" ];
|
||||
|
|
Loading…
Reference in a new issue