load script at bootup

Eric Crist mnslinky at gmail.com
Thu Aug 23 11:59:26 PDT 2007


On Aug 23, 2007, at 1:48 PMAug 23, 2007, Narek Gharibyan wrote:

> #!/bin/sh
>
> Ping -Dc 3600 xxx.xxx.xxx.xxx | tail -4 >>/root/stat && date >> / 
> root/stat
> && echo "===========================" >> /root/stat
>
>
>
> I wrote this script for collecting ping statistic (after I email to  
> a group
> the stat file).
>
> 1. how can I run this at startup

You can use cron with an entry similar to:

@reboot /path/to/script.sh

This will work as long as your script has the execute bit set for the  
user trying to run it.

> 2. how can I restart this script after 3600 counts down

You can use something like sleep, or you can schedule, again using  
cron, the script to run every 3600 seconds.  An entry such as:

0  *   *  *  * /path/to/script.sh

This will re-run your script every hour, on the hour.

> 3. Is there a program, script or any way more appropriate to track the
> packet loss and ping availability.?

I would recommend using some nrpe module you write for nagios and/or  
cacti to monitor and even graph this information.

> Thank you in advance

No problem!

-----
Eric F Crist
Secure Computing Networks




More information about the freebsd-questions mailing list