TechTalkz.com Logo

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Linux & Opensource

Notices

auto-running a script as daemon

Linux & Opensource


Reply
 
Thread Tools Display Modes
Old 06-12-2007, 07:35 AM   #11
Martin Gregorie
Guest
 
Posts: n/a
Re: auto-running a script as daemon

Tony van der Hoff wrote:
> On 5 Dec at 16:25 Gordon Henderson <gordon+usenet@drogon.net> wrote in
> message <fj6jdf$20if$1@energise.enta.net>
>
>> In article <gemini.jsl2w1005t6v4052s.news@nospam.vanderhoff.o rg>, Tony van
>> der Hoff <news_0711@vanderhoff.org> wrote:
>>> I have a perl script to monitor various bits of my server, which I run
>>> as root: /usr/local/sbin/monitor.pl &
>>>
>>> That works fine, but I'd really like to start it automatically on
>>> reboot. How would I organise that?

>> It varies from distro to distro... Eg. Debian look in /etc/init.d for a
>> file called skeleton - this is a bash script, so copy this to eg
>> /etc/init.d/monitorMyStuff and edit to start your own thing, then run

>
> Thanks, Gordon; my distro doesn't have that; I can only see things like
> "Program Files", and "My Documents and Settings".
>
> Um, not really , but I'm running Mandriva, which has its roots in red hat,
> and what Geoff described was ideal.
>

If your distro is RedHat-like, there is a bit of help:
- there's no example script, but its easy enough to find something
suitable in /etc/rc.d/init.d, copy it and edit it. At a minimum
it should have sections that implement start, stop, status and restart
requests. The vs-ftp or sshd scripts are reasonable starting points.

- use the "chkconfig" command to set up the symlinks in /etc/rc.d/rc.n
(where 'n' is the run level) that are used to start or stop the
service whenever the runlevel is changed

- use the "service" command to start, stop and restart the service or
query its status.

chkconfig and service can only be run as root.


--
martin@ | Martin Gregorie
gregorie. | Es***, UK
org |
  Reply With Quote
Old 06-12-2007, 08:12 AM   #12
Martin Gregorie
Guest
 
Posts: n/a
Re: auto-running a script as daemon

Tony van der Hoff wrote:
> On 5 Dec at 16:25 Gordon Henderson <gordon+usenet@drogon.net> wrote in
> message <fj6jdf$20if$1@energise.enta.net>
>
>> In article <gemini.jsl2w1005t6v4052s.news@nospam.vanderhoff.o rg>, Tony van
>> der Hoff <news_0711@vanderhoff.org> wrote:
>>> I have a perl script to monitor various bits of my server, which I run
>>> as root: /usr/local/sbin/monitor.pl &
>>>
>>> That works fine, but I'd really like to start it automatically on
>>> reboot. How would I organise that?

>> It varies from distro to distro... Eg. Debian look in /etc/init.d for a
>> file called skeleton - this is a bash script, so copy this to eg
>> /etc/init.d/monitorMyStuff and edit to start your own thing, then run

>
> Thanks, Gordon; my distro doesn't have that; I can only see things like
> "Program Files", and "My Documents and Settings".
>
> Um, not really , but I'm running Mandriva, which has its roots in red hat,
> and what Geoff described was ideal.
>

If your distro is RedHat-like, there is a bit of help:
- there's no example script, but its easy enough to find something
suitable in /etc/rc.d/init.d, copy it and edit it. At a minimum
it should have sections that implement start, stop, status and restart
requests. The vs-ftp or sshd scripts are reasonable starting points.

- use the "chkconfig" command to set up the symlinks in /etc/rc.d/rc.n
(where 'n' is the run level) that are used to start or stop the
service whenever the runlevel is changed

- use the "service" command to start, stop and restart the service or
query its status.

chkconfig and service can only be run as root.


--
martin@ | Martin Gregorie
gregorie. | Es***, UK
org |
  Reply With Quote
Old 08-12-2007, 06:17 AM   #13
Will Kemp
Guest
 
Posts: n/a
Re: auto-running a script as daemon

On Wed, 05 Dec 2007 15:55:13 +0000, Tony van der Hoff wrote:

> I have a perl script to monitor various bits of my server, which I run
> as root: /usr/local/sbin/monitor.pl &
>
> That works fine, but I'd really like to start it automatically on
> reboot. How would I organise that?


What other people have suggested is good, but personally i'd do it more
simply. For simple custom stuff like this, i can't be bothered with all
that runlevel / rcx.d stuff - there's no need.

I'd just add a line at the bottom of /etc/rc.d/rc.local to start it on
boot. (rc.local is run after the system startup scripts at boot time.) If
you're not concerned about it stopping tidily - i.e., you don't mind it
just being killed unceremoniously on shutdown - this is usually the
simplest way.

If you want it to do anything special on shutdown, then you'll probably
be better off doing as others have suggested.

Will
  Reply With Quote
Old 08-12-2007, 07:37 AM   #14
Will Kemp
Guest
 
Posts: n/a
Re: auto-running a script as daemon

On Wed, 05 Dec 2007 15:55:13 +0000, Tony van der Hoff wrote:

> I have a perl script to monitor various bits of my server, which I run
> as root: /usr/local/sbin/monitor.pl &
>
> That works fine, but I'd really like to start it automatically on
> reboot. How would I organise that?


What other people have suggested is good, but personally i'd do it more
simply. For simple custom stuff like this, i can't be bothered with all
that runlevel / rcx.d stuff - there's no need.

I'd just add a line at the bottom of /etc/rc.d/rc.local to start it on
boot. (rc.local is run after the system startup scripts at boot time.) If
you're not concerned about it stopping tidily - i.e., you don't mind it
just being killed unceremoniously on shutdown - this is usually the
simplest way.

If you want it to do anything special on shutdown, then you'll probably
be better off doing as others have suggested.

Will
  Reply With Quote
Old 08-12-2007, 07:39 AM   #15
Will Kemp
Guest
 
Posts: n/a
Re: auto-running a script as daemon

On Wed, 05 Dec 2007 15:55:13 +0000, Tony van der Hoff wrote:

> I have a perl script to monitor various bits of my server, which I run
> as root: /usr/local/sbin/monitor.pl &
>
> That works fine, but I'd really like to start it automatically on
> reboot. How would I organise that?


What other people have suggested is good, but personally i'd do it more
simply. For simple custom stuff like this, i can't be bothered with all
that runlevel / rcx.d stuff - there's no need.

I'd just add a line at the bottom of /etc/rc.d/rc.local to start it on
boot. (rc.local is run after the system startup scripts at boot time.) If
you're not concerned about it stopping tidily - i.e., you don't mind it
just being killed unceremoniously on shutdown - this is usually the
simplest way.

If you want it to do anything special on shutdown, then you'll probably
be better off doing as others have suggested.

Will
  Reply With Quote
Old 08-12-2007, 08:04 AM   #16
Will Kemp
Guest
 
Posts: n/a
Re: auto-running a script as daemon

On Wed, 05 Dec 2007 15:55:13 +0000, Tony van der Hoff wrote:

> I have a perl script to monitor various bits of my server, which I run
> as root: /usr/local/sbin/monitor.pl &
>
> That works fine, but I'd really like to start it automatically on
> reboot. How would I organise that?


What other people have suggested is good, but personally i'd do it more
simply. For simple custom stuff like this, i can't be bothered with all
that runlevel / rcx.d stuff - there's no need.

I'd just add a line at the bottom of /etc/rc.d/rc.local to start it on
boot. (rc.local is run after the system startup scripts at boot time.) If
you're not concerned about it stopping tidily - i.e., you don't mind it
just being killed unceremoniously on shutdown - this is usually the
simplest way.

If you want it to do anything special on shutdown, then you'll probably
be better off doing as others have suggested.

Will
  Reply With Quote
Old 08-12-2007, 08:05 AM   #17
Will Kemp
Guest
 
Posts: n/a
Re: auto-running a script as daemon

On Wed, 05 Dec 2007 15:55:13 +0000, Tony van der Hoff wrote:

> I have a perl script to monitor various bits of my server, which I run
> as root: /usr/local/sbin/monitor.pl &
>
> That works fine, but I'd really like to start it automatically on
> reboot. How would I organise that?


What other people have suggested is good, but personally i'd do it more
simply. For simple custom stuff like this, i can't be bothered with all
that runlevel / rcx.d stuff - there's no need.

I'd just add a line at the bottom of /etc/rc.d/rc.local to start it on
boot. (rc.local is run after the system startup scripts at boot time.) If
you're not concerned about it stopping tidily - i.e., you don't mind it
just being killed unceremoniously on shutdown - this is usually the
simplest way.

If you want it to do anything special on shutdown, then you'll probably
be better off doing as others have suggested.

Will
  Reply With Quote
Old 08-12-2007, 08:08 AM   #18
Will Kemp
Guest
 
Posts: n/a
Re: auto-running a script as daemon

On Wed, 05 Dec 2007 15:55:13 +0000, Tony van der Hoff wrote:

> I have a perl script to monitor various bits of my server, which I run
> as root: /usr/local/sbin/monitor.pl &
>
> That works fine, but I'd really like to start it automatically on
> reboot. How would I organise that?


What other people have suggested is good, but personally i'd do it more
simply. For simple custom stuff like this, i can't be bothered with all
that runlevel / rcx.d stuff - there's no need.

I'd just add a line at the bottom of /etc/rc.d/rc.local to start it on
boot. (rc.local is run after the system startup scripts at boot time.) If
you're not concerned about it stopping tidily - i.e., you don't mind it
just being killed unceremoniously on shutdown - this is usually the
simplest way.

If you want it to do anything special on shutdown, then you'll probably
be better off doing as others have suggested.

Will
  Reply With Quote
Old 08-12-2007, 08:19 AM   #19
Will Kemp
Guest
 
Posts: n/a
Re: auto-running a script as daemon

On Wed, 05 Dec 2007 15:55:13 +0000, Tony van der Hoff wrote:

> I have a perl script to monitor various bits of my server, which I run
> as root: /usr/local/sbin/monitor.pl &
>
> That works fine, but I'd really like to start it automatically on
> reboot. How would I organise that?


What other people have suggested is good, but personally i'd do it more
simply. For simple custom stuff like this, i can't be bothered with all
that runlevel / rcx.d stuff - there's no need.

I'd just add a line at the bottom of /etc/rc.d/rc.local to start it on
boot. (rc.local is run after the system startup scripts at boot time.) If
you're not concerned about it stopping tidily - i.e., you don't mind it
just being killed unceremoniously on shutdown - this is usually the
simplest way.

If you want it to do anything special on shutdown, then you'll probably
be better off doing as others have suggested.

Will
  Reply With Quote
Old 08-12-2007, 08:33 AM   #20
Will Kemp
Guest
 
Posts: n/a
Re: auto-running a script as daemon

On Wed, 05 Dec 2007 15:55:13 +0000, Tony van der Hoff wrote:

> I have a perl script to monitor various bits of my server, which I run
> as root: /usr/local/sbin/monitor.pl &
>
> That works fine, but I'd really like to start it automatically on
> reboot. How would I organise that?


What other people have suggested is good, but personally i'd do it more
simply. For simple custom stuff like this, i can't be bothered with all
that runlevel / rcx.d stuff - there's no need.

I'd just add a line at the bottom of /etc/rc.d/rc.local to start it on
boot. (rc.local is run after the system startup scripts at boot time.) If
you're not concerned about it stopping tidily - i.e., you don't mind it
just being killed unceremoniously on shutdown - this is usually the
simplest way.

If you want it to do anything special on shutdown, then you'll probably
be better off doing as others have suggested.

Will
  Reply With Quote
Reply

Thread Tools
Display Modes



< Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT +5.5. The time now is 04:20 AM.


vBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2009, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional