Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Mac OS X and having trouble getting a cron job to run. I type the following:

$ sudo -i
$ crontab -e

I then enter:

* * * * * root ifconfig en0 down > /dev/null
0 19 * * * root ifconfig en0 down > /dev/null
0  7 * * * root ifconfig en0 up > /dev/null

and no success, the first line is for testing. I want it to shut off my internet. The next two lines I plan to leave in, once I get this working.

If I type this in to the terminal the internet goes off

ifconfig en0 down

Why is my cron job not shutting down the internet?

FYI: This is a follow up question from most of the comments there are people making fun of me. And a few attempts to solve the problem with out cron jobs.

share|improve this question

migrated from Jun 13 '10 at 0:48

This question came from our site for professional and enthusiast programmers.

When you enter commands in your crontab, you don't need to specify the user, as each user has their own individual crontab stored in /usr/lib/cron/tabs/

Your crontab should look like the following:
* * * * * /sbin/ifconfig en0 down > /dev/null
0 19 * * * /sbin/ifconfig en0 down > /dev/null
0 7 * * * /sbin/ifconfig en0 up > /dev/null

share|improve this answer

Do you have a wifi router, and your airport still open? If so, you need to shut that off as well. Either shut it off permanently though System Preferences -> Networking, or use cron commands to do the same. On my machine the Airport is en1, but I've explained how to check in an answer to your original question if you're not sure.

Another thing to check is the path at the top of the crontab file. It must provide access to the ifconfig command.

Run 'whereis ifconfig' on the terminal to find out where the ifconfig command is located, and add that path to the path command at the top of the crontab file if it's not there.

share|improve this answer

You must log in to answer this question.