Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Nov 1998 22:14:52 -0800 (PST)
From:      Bryce Newall <data@dreamhaven.net>
To:        Dark Thunder <dthunder@ZLA.ML.ORG>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: About INITTAB
Message-ID:  <Pine.NEB.3.96.981102220951.15750b-100000@ds9.dreamhaven.org>
In-Reply-To: <Pine.LNX.3.96.981103003945.23734A-100000@ZLA.ML.ORG>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 3 Nov 1998, Dark Thunder wrote:

> How to create a inittab in FBSD, so FBSD will auto load (with different 
> userid, not root) the program and keep it alive after reboot?  Please
> email me at dthunder@zla.ml.org.

FreeBSD doesn't use inittab like some other Unices, like Linux do.
However, I can see 2 possible solutions to your problem:

1) Turn on the setuid and setgid bits on the program in question, and then
run it from /etc/rc.local.  rc.local, of course, runs as root, but if you
set the setuid and setgid bits on the program, the program will run as the
user and group that owns it, rather than root.

2) Write a small shell that will run as the user ID in question, which
checks to see if the program is running, and if not, starts it.  Then, set
up a cron job for that user to run the script every, say, 5 or 10 minutes.

I would recommend #2 over #1, for 2 reasons:  a) Something that isn't run
as root really shouldn't be run from rc.local; and b) Having the program
run from a cron job will ensure that if the program dies for some reason,
it will get restarted when the cron job kicks in.  I have a few IRC
servers on my system which are all cronned using a similar script, as well
as my web server (which sometimes dies for no apparent reason) and my mail
transport agent (MTA) (which also sometimes dies for no apparent reason).

If you need a sample script, I'll be happy to provide you one.

**********************************************************************
*       Bryce Newall       *       Email: data@dreamhaven.net        *
*               WWW: http://home.dreamhaven.net/~data                *
*       "Insanity takes its toll.  Please have exact change."        *
**********************************************************************


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96.981102220951.15750b-100000>