PDA

View Full Version : [ubuntu] Can't get script to run at boot



trobrock
November 4th, 2009, 05:39 PM
I am trying to get snort to run with the command "snort -c /etc/snort/snort.conf -i eth0 -D" at boot up on my 9.04 server. I have added it to the rc.local file and after boot i try "ps aux | grep snort" and dont find it running, I have also tried adding "@reboot snort -c /etc/snort/snort.conf -i eth0 -D" to my crontab and it still will not run, what am I missing?

karlson
November 4th, 2009, 05:53 PM
I am trying to get snort to run with the command "snort -c /etc/snort/snort.conf -i eth0 -D" at boot up on my 9.04 server. I have added it to the rc.local file and after boot i try "ps aux | grep snort" and dont find it running, I have also tried adding "@reboot snort -c /etc/snort/snort.conf -i eth0 -D" to my crontab and it still will not run, what am I missing?

SNORT or /var/log/daemon.log or /var/log/dmesg or /var/log/messages?

Do they tell you anything?

cdenley
November 4th, 2009, 06:47 PM
You probably don't have the PATH variable set, so it doesn't know where to look for the "snort" command.

trobrock
November 4th, 2009, 07:43 PM
I could not find anything in the logs that referred to the start up of snort during boot, also the path should be fine as I can run the snort command from and location on my machine and it works fine, just not from any of the startup scripts

cdenley
November 4th, 2009, 08:08 PM
I could not find anything in the logs that referred to the start up of snort during boot, also the path should be fine as I can run the snort command from and location on my machine and it works fine, just not from any of the startup scripts

Exactly. Startup scripts don't use the same PATH variable as your user's session. I know crontabs don't have PATH defined by default. I would assume rc.local is the same.

trobrock
November 4th, 2009, 08:41 PM
Ahh that did it thanks