* HELP: My process won't start from /sbin/init.d
@ 1995-07-06 4:00 Thomas Leitner
1995-07-06 4:00 ` Dave Carter
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Thomas Leitner @ 1995-07-06 4:00 UTC (permalink / raw)
Hi,
I wrote a small remote tape daemon which I use to backup our OS/2
machines over the net to a DAT drive connected to the DEC 3000/600
running OSF/1 3.2
For the daemon to start at system boot, I wrote a small startup script
which I put in /sbin/init.d and made the proper symlinks to
/sbin/rc3.d and /sbin/rc2.d like that:
-rwxr-x--- 1 bin bin 624 Jul 6 16:20 init.d/rtape
lrwxrwxrwx 1 root bin 18 Mar 21 15:33 S93rtape -> /sbin/init.d/r
tape
lrwxrwxrwx 1 root bin 18 Mar 21 15:33 K93rtape -> /sbin/init.d/r
tape
A listing of the rtape script is appended to that mail. Now, the problem is,
that during bootup everything looks fine. The "rtaped daemon started."
message appears. But when I log-in and check, the rtaped daemon just is
not running!!!
I have the same problem with another server process of mine and noticed,
that the processes run for a short while during system boot but are
killed after a couple of seconds.
When I start everything under root with
/sbin/init.d/rtape start
the process continues to run.
So my question: What am I doing wrong?
Thanks -- Tom
---------------- rtape script -------------------
#!/bin/sh
#
# start or stop rtaped daemon
#
PATH=/sbin:/usr/sbin:/usr/bin
export PATH
TAPE=/dev/nrmt0h
case "$1" in
'start')
if [ -f /usr/local/bin/rtaped ]; then
pid=`/bin/ps -e | grep rtaped | grep -v grep | sed -e 's/^ *//' -e 's/ .*//' | head -1` ;
if [ "X$pid" = "X" ]; then
/usr/local/bin/rtaped $TAPE &
echo "rtaped daemon started."
fi
fi
;;
'stop')
pid=`/bin/ps -e | grep rtaped | grep -v grep | sed -e 's/^ *//' -e 's/ .*//' | head -1` ;
if [ "X$pid" != "X" ]; then
/bin/kill $pid ;
echo "rtaped daemon killed."
fi
;;
*)
echo "usage: $0 {start|stop}"
exit 1
;;
esac
exit 0
--
Tom Leitner, tom@finwds01.tu-graz.ac.at |\ _,,,---,,_
Dept. of Communications zzz. /,`.-'`' -. ;-;;,_.
Graz University of Technology |,4- ) )-,_. ,\ ( `'-'
Inffeldgasse 12 '---''(_/--' `-'\_)
A-8010 Graz / Austria / Europe, Phone: +43-316-873-7455, Fax: +43-316-463-697
WWW home page: http://wiis.tu-graz.ac.at/people/tom.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: HELP: My process won't start from /sbin/init.d
1995-07-06 4:00 HELP: My process won't start from /sbin/init.d Thomas Leitner
@ 1995-07-06 4:00 ` Dave Carter
1995-07-07 4:00 ` Thomas Leitner
1995-07-07 4:00 ` Eric Werme
1995-07-07 4:00 ` Peter Marksteiner
2 siblings, 1 reply; 7+ messages in thread
From: Dave Carter @ 1995-07-06 4:00 UTC (permalink / raw)
Thomas Leitner (tom@finwds01.tu-graz.ac.at) wrote:
> I wrote a small remote tape daemon which I use to backup our OS/2
> machines over the net to a DAT drive connected to the DEC 3000/600
> running OSF/1 3.2
> For the daemon to start at system boot, I wrote a small startup script
> which I put in /sbin/init.d and made the proper symlinks to
> /sbin/rc3.d and /sbin/rc2.d like that:
> -rwxr-x--- 1 bin bin 624 Jul 6 16:20 init.d/rtape
> lrwxrwxrwx 1 root bin 18 Mar 21 15:33 S93rtape -> /sbin/init.d/r
> tape
> lrwxrwxrwx 1 root bin 18 Mar 21 15:33 K93rtape -> /sbin/init.d/r
> tape
> A listing of the rtape script is appended to that mail. Now, the problem is,
> that during bootup everything looks fine. The "rtaped daemon started."
> message appears. But when I log-in and check, the rtaped daemon just is
> not running!!!
i had a similar problem today, and found that if i numbered the daemon
S93daemon so that it started *after* xdm, it says "daemon starting",
and then dies. however, i then numbered the daemon so that it started
*before* xdm, now it says "daemon starting", and stays running.
wierd.
- dave
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: HELP: My process won't start from /sbin/init.d
1995-07-06 4:00 HELP: My process won't start from /sbin/init.d Thomas Leitner
1995-07-06 4:00 ` Dave Carter
1995-07-07 4:00 ` Eric Werme
@ 1995-07-07 4:00 ` Peter Marksteiner
2 siblings, 0 replies; 7+ messages in thread
From: Peter Marksteiner @ 1995-07-07 4:00 UTC (permalink / raw)
Thomas Leitner (tom@finwds01.tu-graz.ac.at) wrote:
[problem with demon started at boot time being killed]
Try nohup:
nohup /usr/local/bin/rtaped $TAPE &
--
Peter Marksteiner
Vienna University Computer Center
Universitaetsstrasse 7
A-1010 Vienna, Austria
e-mail: Peter.Marksteiner@univie.ac.at
Tel: (+43 1) 406 58 22 255
FAX: (+43 1) 406 58 22 170
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: HELP: My process won't start from /sbin/init.d
1995-07-06 4:00 HELP: My process won't start from /sbin/init.d Thomas Leitner
1995-07-06 4:00 ` Dave Carter
@ 1995-07-07 4:00 ` Eric Werme
1995-07-07 4:00 ` Thomas Leitner
1995-07-11 4:00 ` Peter da Silva
1995-07-07 4:00 ` Peter Marksteiner
2 siblings, 2 replies; 7+ messages in thread
From: Eric Werme @ 1995-07-07 4:00 UTC (permalink / raw)
tom@finwds01.tu-graz.ac.at (Thomas Leitner) writes:
>I wrote a small remote tape daemon which I use to backup our OS/2
>machines over the net to a DAT drive connected to the DEC 3000/600
>running OSF/1 3.2
>A listing of the rtape script is appended to that mail. Now, the problem is,
>that during bootup everything looks fine. The "rtaped daemon started."
>message appears. But when I log-in and check, the rtaped daemon just is
>not running!!!
When the rc3 script finishes, I believe the stray processes all get a signal
that kills them. (I'm not certain of the genesis and don't have time or
need to learn, so don't ask!)
Our daemons usually call the BSD daemon routine (its in /usr/lib/libutil.a)
This disconnects from controlling session to leave a process running on its
own.
> /usr/local/bin/rtaped $TAPE &
^ Get rid of the ampersand!
Call this early in main():
daemon(nochdir, noclose)
int nochdir, noclose;
{
int cpid;
if ((cpid = fork()) == -1)
return (-1);
if (cpid)
exit(0);
key>>> (void) setsid();
if (!nochdir)
(void) chdir("/");
if (!noclose) {
int devnull = open("/dev/null", O_RDWR, 0);
if (devnull != -1) {
(void) dup2(devnull, 0);
(void) dup2(devnull, 1);
(void) dup2(devnull, 2);
if (devnull > 2)
(void) close(devnull);
}
}
return(0);
}
Getting rid of the ampersand ensures that daemon() runs.
Oh yeah - I don't understand this session stuff, etiher. :-)
--
Eric (Ric) Werme | werme@zk3.dec.com
Digital Equipment Corp. | This space intentionally left blank.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: HELP: My process won't start from /sbin/init.d
1995-07-07 4:00 ` Eric Werme
@ 1995-07-07 4:00 ` Thomas Leitner
1995-07-11 4:00 ` Peter da Silva
1 sibling, 0 replies; 7+ messages in thread
From: Thomas Leitner @ 1995-07-07 4:00 UTC (permalink / raw)
Eric,
Eric Werme (werme@alingo.zk3.dec.com) wrote:
: tom@finwds01.tu-graz.ac.at (Thomas Leitner) writes:
: >I wrote a small remote tape daemon which I use to backup our OS/2
: >machines over the net to a DAT drive connected to the DEC 3000/600
: >running OSF/1 3.2
: >A listing of the rtape script is appended to that mail. Now, the problem is,
: >that during bootup everything looks fine. The "rtaped daemon started."
: >message appears. But when I log-in and check, the rtaped daemon just is
: >not running!!!
: When the rc3 script finishes, I believe the stray processes all get a signal
: that kills them. (I'm not certain of the genesis and don't have time or
: need to learn, so don't ask!)
: Our daemons usually call the BSD daemon routine (its in /usr/lib/libutil.a)
: This disconnects from controlling session to leave a process running on its
: own.
: > /usr/local/bin/rtaped $TAPE &
: ^ Get rid of the ampersand!
[...]
Well, I use the same startup script under Solaris 2.3 (which is SYSV as well)
only put in a different place of course.
: Call this early in main():
[...]
Thanks for the code. If everything else fails, I'll try to do that. But
I want to try to get it going with tricks on the shell level rather that
to change the code.
What if I just say:
/usr/local/bin/rtaped $TAPE </dev/null &
and additionally keep SIGTERM from being delivered with a
trap "" 15
: Oh yeah - I don't understand this session stuff, etiher. :-)
:-)
Thanks again -- Tom
--
Tom Leitner, tom@finwds01.tu-graz.ac.at |\ _,,,---,,_
Dept. of Communications zzz. /,`.-'`' -. ;-;;,_.
Graz University of Technology |,4- ) )-,_. ,\ ( `'-'
Inffeldgasse 12 '---''(_/--' `-'\_)
A-8010 Graz / Austria / Europe, Phone: +43-316-873-7455, Fax: +43-316-463-697
WWW home page: http://wiis.tu-graz.ac.at/people/tom.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: HELP: My process won't start from /sbin/init.d
1995-07-06 4:00 ` Dave Carter
@ 1995-07-07 4:00 ` Thomas Leitner
0 siblings, 0 replies; 7+ messages in thread
From: Thomas Leitner @ 1995-07-07 4:00 UTC (permalink / raw)
Dave Carter (carter@shelby.mst6.lanl.gov) wrote:
: Thomas Leitner (tom@finwds01.tu-graz.ac.at) wrote:
: > I wrote a small remote tape daemon which I use to backup our OS/2
: > machines over the net to a DAT drive connected to the DEC 3000/600
: > running OSF/1 3.2
: > For the daemon to start at system boot, I wrote a small startup script
: > which I put in /sbin/init.d and made the proper symlinks to
: > /sbin/rc3.d and /sbin/rc2.d like that:
: > -rwxr-x--- 1 bin bin 624 Jul 6 16:20 init.d/rtape
: > lrwxrwxrwx 1 root bin 18 Mar 21 15:33 S93rtape -> /sbin/init.d/r
: > tape
: > lrwxrwxrwx 1 root bin 18 Mar 21 15:33 K93rtape -> /sbin/init.d/r
: > tape
: > A listing of the rtape script is appended to that mail. Now, the problem is,
: > that during bootup everything looks fine. The "rtaped daemon started."
: > message appears. But when I log-in and check, the rtaped daemon just is
: > not running!!!
: i had a similar problem today, and found that if i numbered the daemon
: S93daemon so that it started *after* xdm, it says "daemon starting",
: and then dies. however, i then numbered the daemon so that it started
: *before* xdm, now it says "daemon starting", and stays running.
: wierd.
Well, I got my two daemons started *before* xdm:
S85wiissrv
S93rtape
S94mmeserver
S95xdm
So xdm is the latest daemon started. This is really weird. *Something*
kills my daemons after they are started. I checked the logs of my
wiissrv daemon and found that it gets a SIGTERM signal.
Anyone else got any clue what's going on?
Thanks -- Tom
--
Tom Leitner, tom@finwds01.tu-graz.ac.at |\ _,,,---,,_
Dept. of Communications zzz. /,`.-'`' -. ;-;;,_.
Graz University of Technology |,4- ) )-,_. ,\ ( `'-'
Inffeldgasse 12 '---''(_/--' `-'\_)
A-8010 Graz / Austria / Europe, Phone: +43-316-873-7455, Fax: +43-316-463-697
WWW home page: http://wiis.tu-graz.ac.at/people/tom.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: HELP: My process won't start from /sbin/init.d
1995-07-07 4:00 ` Eric Werme
1995-07-07 4:00 ` Thomas Leitner
@ 1995-07-11 4:00 ` Peter da Silva
1 sibling, 0 replies; 7+ messages in thread
From: Peter da Silva @ 1995-07-11 4:00 UTC (permalink / raw)
In article <werme.805130754@alingo.zk3.dec.com>,
Eric Werme <werme@zk3.dec.com> wrote:
> Our daemons usually call the BSD daemon routine (its in /usr/lib/libutil.a)
> This disconnects from controlling session to leave a process running on its
> own.
Which is really annoying when you want to do something like wait for the
daemon to terminate to get around a bug while waiting (in the sitting
around sense, not the system call) for a vendor to fix it.
What is really needed is a *program* to daemonize another program. In BSD
the nohup command might do the job. In System V I wrote a program called
detach that does it.
--
Peter da Silva (NIC: PJD2) `-_-'
Network Management Technology Incorporated 'U`
1601 Industrial Blvd. Sugar Land, TX 77478 USA
+1 713 274 5180 "Har du kramat din varg idag?"
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~1995-07-11 4:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-07-06 4:00 HELP: My process won't start from /sbin/init.d Thomas Leitner
1995-07-06 4:00 ` Dave Carter
1995-07-07 4:00 ` Thomas Leitner
1995-07-07 4:00 ` Eric Werme
1995-07-07 4:00 ` Thomas Leitner
1995-07-11 4:00 ` Peter da Silva
1995-07-07 4:00 ` Peter Marksteiner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox