How to make a daemon

Stephen P. Marr stephm at sco.COM
Fri May 13 04:57:53 AEST 1988


In article <194 at ssbn.WLK.COM> bill at ssbn.WLK.COM (Bill Kennedy) writes:
 =>I am in a bit of a quandry and it appears that the net is going to be
 =>able to respond before SCO will, so here's my m'aidez -

Surprise!  SCO Calling!

 =>I need to respawn a process like a getty so that's there's nearly always
 =>a copy active.  In straight ahead System V (I have SCO Vr2.2.3 80386) I
 =>just put an entry in /etc/inittab that says
 =>
 =>30:23:respawn:/usr/lib/clubs/omron ttym07
 =>
 =><...>
 =>
 =>I joked to my SCO sales rep today that if it wasn't for this group, they'd
 =>be three weeks behind instead of just three days.  Thanks,
 =>-- 
 =>Bill Kennedy  usenet      {rutgers,ihnp4!killer,cbosgd}!ssbn!bill
 =>              internet    bill at ssbn.WLK.COM

Here's a way to do it (albeit certainly not the only way):

set up an entry in /etc/gettydefs which utilizes the AUTO option e.g.

z # B9600 HUPCL # B9600 CS8 SANE TAB3 ECHOE IXANY # # p # AUTO prog_name

and then modify an entry in /etc/ttys to use this gettydef entry and enable
that port.  What will happen is this:  init will spawn a getty which will
see the AUTO keyword and fork (login by default) the specified program.
Note that argv[1] is going to be the basename of the controlling tty, and
that there is no utmp entry or any real environment to speak of.  Your
uid and gid are 0 at this point so standard setuid-root paranoia should
be applied.

More info could be gleaned from gettydefs(F) init(M) and getty(M).  SCO
support has further info if you need it.  Good luck.
-- 
Steph Marr,  The Santa Cruz Operation Inc.,  ...!{uunet,ihnp4,ucscc}!sco!stephm
Internet: (MX Handlers) stephm at sco.COM  (Others) @ucscc.ucsc.edu:stephm at sco.COM
"There was coffee.  Life would go on."     --William Gibson



More information about the Comp.unix.xenix mailing list