From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,e1f062a1ac84e1b6 X-Google-Attributes: gidfee84,public From: werme@alingo.zk3.dec.com (Eric Werme) Subject: Re: HELP: My process won't start from /sbin/init.d Date: 1995/07/07 Message-ID: #1/1 X-Deja-AN: 105828824 references: <3tgv3v$q71@fstgds15.tu-graz.ac.at> organization: Digital Equipment Corporation reply-to: werme@zk3.dec.com newsgroups: comp.unix.osf.osf1 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.