On Tue, 2005-01-25 at 09:57 -0800, Jeremy C. Reed wrote:
> On Tue, 25 Jan 2005, Craig White wrote:
>
> > /root/relaydelay-0.04/relaydelay.pl &
> >
> > then it outputs to terminal I ran it from.
> >
> > If I use
> >
> > /root/relaydelay-0.04/relaydelay.pl 2>&1
> >
> > then I don't get the terminal back at all - as if it hasn't forked. I
> > need to have this run as a service without output to a terminal and
> > obviously run without a terminal connection at all. How do I do this?
>
> So also have it output file handle 1 to a file and background it too.
>
> But instead, you may want to use nohup, such as:
>
> nohup /root/relaydelay-0.04/relaydelay.pl
----
I should point out that even though this is finished that through this
process I learned even more.
In the case of my issues, the perl script never detached from the
terminal - regardless of my efforts but they did have a version in cvs
that gave me options such as to 'dameonize' (i.e. detach from the
terminal) and to direct logging (i.e. file such
as /var/log/relaydelay.log or /dev/null).
But most importantly (and I doubt this is just Red Hat) there is a
package of utilities called 'initscripts' - one of the files is
installed in /etc/init.d (in redhat, it's /etc/rc.d/init.d without the
shorthand) and it's called 'functions' and this file has a number of
subroutines for helping to launch a daemonized process as well.
So in the end, I neither had to worry about nohup launching (which never
did work) or directing standard and error out away from the terminal
because I also needed it to detach from terminal and those things
necessarily have to be handled to do that.
Though I may never write another SysV script - I have a better
understanding of it.
Craig
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss