1. Implement cron package from this tutorial:
http://www.macsat.com/cron.php
2. Modify the following files:
/opt/etc/crontab
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/bin:/opt/sbin:/opt/usr/bin:/opt/usr/sbin:/opt/etc
MAILTO=""
HOME=/
# ---------- ---------- Default is Empty ---------- ---------- #
# Syntax for lines is : minute hour day month dayofweek command #
*/1 * * * * admin run-parts /opt/etc/cron.1min
*/5 * * * * admin run-parts /opt/etc/cron.5mins
01 * * * * admin run-parts /opt/etc/cron.hourly
02 4 * * * admin run-parts /opt/etc/cron.daily
22 4 * * 0 admin run-parts /opt/etc/cron.weekly
42 4 1 * * admin run-parts /opt/etc/cron.monthly
NOTE : instead of "admin" use your administrator account name!
/opt/bin/run-parts
#!/bin/sh
if [ -z "$1" ]
then
echo "Usage : $0 "
fi
RUNDIR=$1"/*"
for i in $RUNDIR ;do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
esac
done
3. mkdir /opt/etc/cron.1min
4. create /opt/etc/cron.1min/ping.sh
echo " " >> /tmp/pingtest.log
echo "********************************************* " >> /tmp/pingtest.log
date >> /tmp/pingtest.log
ping -c 3 xxx.xxx.xxx.xxx >> /tmp/pingtest.log
echo "********************************************* " >> /tmp/pingtest.log
echo " " >> /tmp/pingtest.log
NOTE: -c 3 is the numer of pings
NOTE: instead of xxx.xxx.xxx.xxx put an IP address reacheble from your router, to be used for testing (try to put the default gateway for the connection, or the DNS server)
5. create /tmp/pingtest.log
6. append the /usr/local/.files by adding the folling line:
/tmp/pingtest.log
NOTE: in case of a restart, the content of the file is stored on the disk/stick
RESULT: every minute, 3 ICMP packages (ping) will be sent to the IP address, resulting in a keep-alive for the connection.
Good luck!