Re: Can't Detach from a startup script

2008-08-31 Thread Kent West

Martin wrote:

On Sat, Aug 30, 2008 at 5:56 AM, Kent West [EMAIL PROTECTED] wrote:
  

case $1 in
 start)
  echo -n Starting $DESC: 
  start-stop-daemon -c $USER --start --quiet --pidfile $PIDFILE --exec
$DAEMON -- $OPT \
   /dev/null



hmm looks to my that either you missed the --background option for
start-stop-daemon or you missed the option for $DAEMON to send it to
background...
  


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.


So you're suggesting that I DO use the -b (or --background) option, that 
this is the correct fix for my problem?


I did add that in, and now I can exit out of my ssh session after 
starting the daemon, but as I say, since the man page says that's a last 
resort, I wasn't sure I should do that. (And I haven't tried to see if a 
restart or stop works properly from my script with that added in.)


Thanks!


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


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Can't Detach from a startup script

2008-08-30 Thread Martin
Hi,

On Sat, Aug 30, 2008 at 5:56 AM, Kent West [EMAIL PROTECTED] wrote:
 I'm trying to run Maple12 from my Debian box. I've hacked a startup script
 together that looks like this:
 case $1 in
  start)
   echo -n Starting $DESC: 
   start-stop-daemon -c $USER --start --quiet --pidfile $PIDFILE --exec
 $DAEMON -- $OPT \
/dev/null

hmm looks to my that either you missed the --background option for
start-stop-daemon or you missed the option for $DAEMON to send it to
background...


hth
martin


-- 
http://www.xing.com/profile/Martin_Marcher

You are not free to read this message,
by doing so, you have violated my licence
and are required to urinate publicly. Thank you.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Can't Detach from a startup script

2008-08-29 Thread Kent West
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 [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]