Can't Detach from a startup script



I'm trying to run Maple12 from my Debian box. I've hacked a startup script together that looks like this:

<Beginning of Script>
==============
#! /bin/sh

# Maple 12
# I hacked this script from a copy of the "lisa" start-up script; no guarantees that it works properly.
# Kent West, 14 June 2007
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/Maple_Network_Tools/FLEXlm/lmgrd
OPT=" -c /usr/local/Maple_Network_Tools/activate/Maple12.lic -l /var/log/maplelicense"
NAME=lmgrd
PIDFILE=/var/run/$NAME.pid
DESC="Maple License Server"
USER=maple

test -f $DAEMON || exit 0

set -e

case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon -c $USER --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $OPT \
> /dev/null
echo $(pidof lmgrd) > $PIDFILE
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE \
--exec $DAEMON
rm -f $PIDFILE
echo "$NAME."
;;
reload|force-reload)
echo "Reloading $DESC configuration files."
start-stop-daemon --stop --quiet --signal 1 --pidfile $PIDFILE \
--exec $DAEMON
;;
restart)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE \
--exec $DAEMON
rm -f $PIDFILE
sleep 1
start-stop-daemon -c $USER --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $OPT \
> /dev/null
echo $(pidof lmgrd) > $PIDFILE
echo "$NAME."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac

exit 0

============
</End of Script>

Tonight I added in the "-c $USER" piece under the "start" and "restart" stanzas, because otherwise the deamon was running as root, which is not recommended by makers of Maple. (I created a user named "maple" and set the shell to /bin/false; anything else I should do to tighten the security on that user?)

Before I made this change, I could ssh into the box, run "sudo /etc/init.d/maplelicense start", and then exit from my ssh session.

Now when I run the script, my ssh session won't let go; it just hangs after I type "exit". If I ssh in from another shell and run "sudo /etc/init.d/maplelicense stop", my first ssh session then terminates.

I see from the start-stop-daemon man page that I might can throw in a "-b" to force a detachment, but is that the correct way to fix my problem? The man page suggests that this should be a last resort.

Thanks!


--
Kent West <")))><
Westing Peacefully - http://kentwest.blogspot.com


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx



Relevant Pages

  • Re: [Full-disclosure] reduction of brute force login attempts via SSHthrough iptables --
    ... Anyhow its no problem at all to modify, so if you dont like it, just dont use it. ... on a lame script like this as long as it WORKS and is not insecure. ... echo "~ sorting out ip by ip" ... # echo "not enough failed logins, probably no attack from: ...
    (Full-Disclosure)
  • Ripping Tapes with Linux--How To
    ... the full script is located in the BASH ... My tape player is a portable style journalist's recorder from the ... The most irritating part of the recording process was setting the ... echo Starting de-noise procedure to file $TMP1 ...
    (comp.os.linux.misc)
  • Re: Linux Backup with Modification Date Filter?
    ... I wrote a bash script that acts as a wrapper to rsnapshot which first ... generates a modification-date filter, ...
    (comp.os.linux.misc)
  • Re: Command Script variable value lost during execution
    ... The value of RC_ver is numeric but ECHO would return it numeric or not... ... I checked ERRORLEVEL at the end of the script and it was 0 but again ... ECHO RoboCopy version xxx%RC_Ver%yyy ... CALL:GetRCVer RoboCopy.exe /Path ...
    (microsoft.public.windows.server.scripting)
  • Re: Bit Twister: Is this the dhclient-exit-hooks you were talking about?
    ... If you are running the dhclient then all you have to do is ... create the hooks script with YOUR CODE. ... DNS server with my wgets and then restart my firewall. ... You can put an echo statement on commands to show you what will happen ...
    (alt.os.linux)

Loading