[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: LSB conform init script (impossible?)



Chris Lawrence wrote:
> On Thu, Jul 31, 2008 at 5:39 AM, Martin Vogt <vogt@itwm.fraunhofer.de> wrote:
>> the script itsself (from the first mail)
>>
>> http://lists.debian.org/debian-lsb/2008/07/msg00000.html
>>
>> can be used for debugging. Maybe it can be used for a skeleton.lsb/
>> example or something.
> 
> Since I don't have svnserve installed that's going to be rather hard to do. :)
> 

Hello Chris,

no problem I can provide you with a minimalist daemon replacement :)

Here is a simple perl minid script:
>cat minid.pl
#!/usr/bin/perl -w
# detach from tty
main:
$pid = fork;
exit if $pid;
die "fork: $!" unless defined $pid;
print "continue in child";
sleep(4000);

>
This is then the daemon "executable" minid.pl.


The changes in the init script are:


DAEMON="/path/to/your/minid.pl"

PARA=" "
. /lib/lsb/init-functions

With this you should be able to reproduce the behaviour.

Attached is the output of "-x" , it looks that the "pidfile"
or not giving a pidfile is the problem here.
Tested it on SuSE 10.1, works fine, but sometime reports
a stat error on proc, but works nonetheless (Suse, not debian)

regards,

Martin


The output of sh -x svnd stop:

 sh -x /tmp/svnd stop;
+ DAEMON=/tmp/minid.pl
+ PARA=' '
+ . /lib/lsb/init-functions
++ FANCYTTY=
++ '[' -e /etc/lsb-base-logging.sh ']'
++ true
+ case "$1" in
+ echo -n 'Shutting down /tmp/minid.pl '
Shutting down /tmp/minid.pl + killproc /tmp/minid.pl -TERM
+ local pidfile sig status base i name_param is_term_sig
+ pidfile=
+ name_param=
+ is_term_sig=no
+ OPTIND=1
+ getopts p: opt
+ shift 0
+ base=minid.pl
+ '[' '!' ']'
+ pidfile=/var/run/minid.pl.pid
+ name_param='--name minid.pl'
++ echo -TERM
++ sed -e 's/^-\(.*\)/\1/'
+ sig=TERM
++ echo TERM
++ sed -e 's/^SIG\(.*\)/\1/'
+ sig=TERM
+ '[' -z TERM -o TERM = 15 -o TERM = TERM ']'
+ is_term_sig=yes
+ status=0
+ '[' '!' yes = yes ']'
+ /sbin/start-stop-daemon --stop --pidfile /var/run/minid.pl.pid --retry
5 --qui
et --oknodo --name minid.pl
+ '[' 0 = 1 ']'
+ '[' 0 = 0 -a yes = yes ']'
+ pidofproc -p /var/run/minid.pl.pid /tmp/minid.pl
+ local pidfile line i pids= status specified pid
+ pidfile=
+ specified=
+ OPTIND=1
+ getopts p: opt
+ case "$opt" in
+ pidfile=/var/run/minid.pl.pid
+ specified=1
+ getopts p: opt
+ shift 2
+ '[' -z /var/run/minid.pl.pid ']'
+ '[' -f /var/run/minid.pl.pid ']'
+ '[' -x /bin/pidof -a '!' 1 ']'
+ return 4
+ rm -f /var/run/minid.pl.pid
+ return 0
+ RETVAL=0
+ '[' x0 = x0 ']'
+ log_success_msg
+ echo



> What would be helpful is the output of sh -x /etc/init.d/svnserve;
> that would at least give me something to go on as to why things aren't
> working correctly.
> 
> 
> Chris



Reply to: