Date: Sat, 6 Oct 2007 10:47:54 -0500 From: "Jay Banks" <jay-b@quest4.org> To: <freebsd-rc@freebsd.org> Subject: Getting a script to run at boot Message-ID: <004d01c80830$5447e770$90bd050c@4BANKS>
next in thread | raw e-mail | index | archive | help
I'm having a lot of trouble getting scripts to run on startup. It seems = like a simple concept, but I reboot and reboot and reboot, and the = script isn't running. I've had to fight with stuff before but I can = usually get it going (arpwatch, mpd, etc.). Now I'm trying to get sntop = to run now and I'm getting nowhere. Here is my sntop setup. I created /usr/local/etc/rc.d/sntop.sh (with chmod 755 as per the docs). Here is the script, which I got from the FreeBSD handbook: #!/bin/sh # # PROVIDE: sntop # REQUIRE: DAEMON # KEYWORD: shutdown #!/bin/sh # # PROVIDE: sntop # REQUIRE: DAEMON # KEYWORD: shutdown # # DO NOT CHANGE THESE DEFAULT VALUES HERE # SET THEM IN THE /etc/rc.conf FILE # sntop_enable=3D${sntop_enable-"NO"} sntop_flags=3D${sntop_flags-""} sntop_pidfile=3D${sntop_pidfile-"/var/run/sntop.pid"} . /etc/rc.subr name=3D"sntop" rcvar=3D`set_rcvar` command=3D"/usr/local/bin/sntop" load_rc_config $name pidfile=3D"${sntop_pidfile}" start_cmd=3D"echo \"Starting ${name}.\"; /usr/bin/nice -5 ${command} = ${sntop_flags } ${command_args}" run_rc_command "$1" Here is what I added to /etc/rc.conf sntop_enable=3D"YES" sntop_flags=3D"-d -r 30 -f /etc/sntoprc/sntoprc -w -e = /usr/home/mysites/www/data/e tb/index.html" If I change directory to /usr/local/etc/rc.d and do: perl sntop.sh start The sntop will start and show up running in the system processes. It = seems to refresh and all of the other flags seem to work. However, if I = close the terminal session, that's it, it's dead.=20 And if I reboot, it will not show up to be running in the system = processes. Considering that sntop would be a type of script that one would want to = make sure it is always running, I wish this could be addressed in the = man pages.=20 Also, giving my issues here, I just tried to create a cron job to run = it. That didn't work because it gets an error regarding fping. I'm really a big advocate of FreeBSD, but for the love of all things = holy, I could have a program start up on a Windows 2003 server in less = than 10 minutes.=20
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?004d01c80830$5447e770$90bd050c>