What's new

Permanent Ping

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

robs8

New Around Here
Hello Community!

Can someone help me? My current situation is very difficult because my ISP disconnect my USB Dongle from the internet after a few hours.

I heard an permanent ping could solve this problem. I searched for a solution and what i found was this: http://www.dd-wrt.com/wiki/index.php/Script_Examples

"Keep ISP from disconnecting due to lack of traffic"

My question: How I rewrite this script for asus-wrt?
Can someone help me rewrite the script?

Thanks :)
 
I would use the crontab feature, rather than starting a script that runs constantly and waits.
----
** Crond **
Crond will automatically start at boot time. You can put your cron
tasks in /var/spool/cron/crontabs/ . The file must be named "admin" as
this is the name of the system user. Note that this location resides in
RAM, so you would have to put your cron script somewhere such as in the
jffs partition, and at boot time copy it to /var/spool/cron/crontabs/
using an init-start user script.

A simple way to manage your cron jobs is through the included "cru"
command. Just run "cru" to see the usage information. You can then
put your "cru" commands inside a user script to re-generate your cron
jobs at boot time.
----
admin@l33tw0pr:/tmp/mnt# cru

Cron Utility
add: cru a <unique id> <"min hour day month week command">
delete: cru d <unique id>
list: cru l
----

Google doesn't easily find a tutorial on this, so unless somebody knows one, you need a bit of Linux knowledge.

Above command would be like:

cru a 1 "5 * * * * /path/to/my/script/file"

This will run a script every 5 minutes.

Your script ONLY needs the ping command.

#!/bin/sh
ping -c 5 www.example.com >/dev/null # ping 5 packets
 
Last edited:
watusi is absolutely right, but I would just run cru -l to check that there's no task with that unique ID first, and then add the task.
 
The script can be ran continuously without requiring you to execute the command. The beauty of having a router that runs a lite version of linux.
 
I think that the logic being suggested by "watusi" is using the cron facility within the router itself to run the ping script every five minutes. You will then get five pings every five minutes to keep the link alive.
 
Yes, I think I understood that,
but wouldn't that be achieved with just a command instead ??
(can't understand the use/need of script in this case)

Code:
admin@Netgear:/tmp/home/root#
admin@Netgear:/tmp/home/root# cru a 1 "5 * * * * ping -c 5 8.8.8.8 >/dev/null"
admin@Netgear:/tmp/home/root# cru l
5 * * * * ping -c 5 8.8.8.8 >/dev/null #1#
admin@Netgear:/tmp/home/root#


I think that the logic being suggested by "watusi" is using the cron facility within the router itself to run the ping script every five minutes. You will then get five pings every five minutes to keep the link alive.
 
BTW, I guess that "5 * * * *" results in command (or script) is executed
5 past every hour, not every 5 minutes at least not in 376.49_a1
 
Yes, it would actually be executed hourly at 5 minutes after the hour.

cron table entry format
# * * * * * command to execute
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ └───── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
# │ │ │ └────────── month (1 - 12)
# │ │ └─────────────── day of month (1 - 31)
# │ └──────────────────── hour (0 - 23)
# └───────────────────────── min (0 - 59)
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top