A Little Script of My Own

At this point you should be able to control your Wemo Switch from the command line with these commands:

wemo switch "CableModem" off

wemo switch "CableModem" on

Use the name you chose for your Wemo Switch when executing these commands. You should verify this works before proceeding.

For a detailed description of the wemo tool options, check out the documentation here.

Now download the shell script wemoswitch.sh to your local drive, and make the script executable:
chmod +x wemoswitch.sh

Open wemoswtich.sh with your favorite text editor (vi, right?) and change the variable WEMOSWITCH to the name you gave your Wemo Switch. The variable PINGTARGET is set to Google's DNS server. You can leave that alone unless you prefer another ip address.

If the script complains it can't find all the commands it needs to run, you may have to modify the file paths to the needed executables.

This script will ping a known-good target, in this case Google's DNS server, and if it does not reply the script will ping it again. If the second attempt fails, the script will cycle power on the cable modem.

Lastly we need to add the script as a cronjob so it will execute every 15 minutes or however often you desire:

crontab -e

Then add the following entry and save the file:
*/15 * * * * /path/to/the/script/wemoswitch.sh

Naturally, replace the path with the full path to your script.
Now we are done!