Koozali.org: home of the SME Server

How to add command upon boot ?

Jesper

How to add command upon boot ?
« on: September 04, 2002, 10:55:31 PM »
My MRTG and Cacti has now worked flawlessly for quite some time now. I then had to reboot and noticed that the SNMP deamon did autostart during boot.

I would like the command:
"service snmpd start"

to be issued upon boot.

How do I ensure that ?

(I know stupid question if you know Linux but I am not an expert)

I hope anyone can help here.

Thanks,
Jesper

Nathan Fowler

Re: How to add command upon boot ?
« Reply #1 on: September 05, 2002, 06:14:31 AM »
No question is stupid... unless you don't take the time to seek the answer first.

The file you want to modify is /etc/rc.d/rc.local, it's quite similar to the "autoexec.bat" of the Dos days.  Ensure you use the full path to the executable, I don't think rc.local operates with an environment set (please correct me if I am wrong).  I pretty confident this file isn't templated, at least in pre-5.5 I am sure.  Perhaps 5.5 has templated it...

Hope this helped,
Nathan

Dan Brown

Re: How to add command upon boot ?
« Reply #2 on: September 05, 2002, 06:24:41 AM »
Nathan, you've answered the question he asked, but it's not really the best way to do what he wants to do.  A better thing to do would be to make a symlink in /etc/rc.d/rc7.d, like this:

# cd /etc/rc.d/rc7.d
# ln -s /etc/rc.d/init.d/snmpd S95snmpd

This will automatically start snmpd near the end of the sequence whenever the system starts.  The only problem is that this will be removed whenever a console-save is done (because SME regenerates all the links in runlevel 7 at that time).  To take care of this, we'd also do

# /sbin/e-smith/config set snmpd service InitscriptOrder 95 status enabled

This way, SME should rebuild that link along with the others.

Charlie Brady

Re: How to add command upon boot ?
« Reply #3 on: September 05, 2002, 07:22:41 AM »
Nathan Fowler wrote:

>  I pretty confident this file isn't templated, at
> least in pre-5.5 I am sure.  Perhaps 5.5 has templated it...

No need to template it. Any scripts you want to run should be dropped into /etc/e-smith/events/local - they will be run when rc.local runs "signal-event local".

Charlie

Jesper

Re: How to add command upon boot ?
« Reply #4 on: September 05, 2002, 11:11:26 PM »
That did the job. I will place in my personal Howto which is shared among my SME/linux beginner friends.

Thanks a lot,
Jesper