Oct 13, 2011
tom

Setting up Cron Jobs as Root

Question

I can run cron jobs manually like this

root@myhosting [~]# sync ; echo 0 > /proc/sys/vm/drop_caches

I can add it in to cPanel like this. This doesnt work because I need root access.

 * */4 * * sync; echo 0 > /proc/sys/vm/drop_caches

So that leaves me to add the job using putty logged in as root. The above code doesn’t work in putty. I get command not found

Answer

Run crontab -e. That will put you into an editor where you can add the cron line.

If you end up in an editor you don’t know how to use, you can change it temporarily with

EDITOR=nano crontab -e

Related posts:

  1. User cron jobs are not running but system jobs are
  2. run all cron jobs under crontab
  3. Unix Cron : Can we set cron jobs to run at the same time
  4. Is it a security risk to run my crontab jobs as root?
  5. What user do scripts in the cron folders run as? (i.e. cron.daily, cron.hourly, etc)

Leave a comment