Re: auto-running a script as daemon



Tony van der Hoff wrote:
On 5 Dec at 16:25 Gordon Henderson <gordon+usenet@xxxxxxxxxx> wrote in
message <fj6jdf$20if$1@xxxxxxxxxxxxxxxxx>

In article <gemini.jsl2w1005t6v4052s.news@xxxxxxxxxxxxxxxxxxxxx>, Tony van
der Hoff <news_0711@xxxxxxxxxxxxxx> 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. | Essex, UK
org |
.



Relevant Pages

  • Re: Bit Twister: Is this the dhclient-exit-hooks you were talking about?
    ... If you are running the dhclient then all you have to do is ... create the hooks script with YOUR CODE. ... DNS server with my wgets and then restart my firewall. ... You can put an echo statement on commands to show you what will happen ...
    (alt.os.linux)
  • Re: Resetting Serial Sequence Each Month
    ... If it's the order number that needs to restart each month, ... same process as above - either mine if the database is Quit each night (so ... that the script can be run when the database is re-opened the next day), ... (although it depends on how the rest of the database is set-up and how it ...
    (comp.databases.filemaker)
  • Using VBScript to refresh group policy, restart, and log in.
    ... I am writing a script that needs to apply the domain's group policy, ... clearing the legal message text and ... after I restart the account's name goes back to ...
    (microsoft.public.windowsxp.general)
  • Using VBScript to refresh group policy, restart, and log in.
    ... I am writing a script that needs to apply the domain's group policy, ... clearing the legal message text and ... after I restart the account's name goes back to ...
    (microsoft.public.scripting.vbscript)
  • Re: Shutdown & Program Restarts Computer
    ... >>restart the computer. ... >>test version of my main script which just has the shutdown bit in and I ... >>the 'Execute Program' be hidden and normal. ... >>Help me SMS Installer people, ...
    (microsoft.public.sms.installer)