Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So, here's what I did:

  1. Logged in as root via Shell
  2. Typed crontab -e
  3. Typed */30 * * * * /path_to_website/cronjobs/cron.php

And now what? How do I save it? I just closed Putty and then logged back in as root, typed crontab -l, and no crons were added. So I must have screwed up somewhere.

I'd appreciate if someone could give me more detailed information.

And weirdly enough, when I log in as root and type crontab -e and I try to enter */30 * * * * ... it doesn't work right away (it only lets me type /). I first have to press like every key that's on my keyboard.

share|improve this question
1  
If you have root access to this machine, you owe every user on it the courtesy of learning how to use vi. –  glenn jackman Aug 12 '11 at 20:24
    
Well, good thing I'm the only user on that machine. Haha. –  user93981 Aug 12 '11 at 20:26
1  
Well then, you owe it to yourself :) –  glenn jackman Aug 12 '11 at 20:44
add comment

migrated from stackoverflow.com Aug 12 '11 at 20:24

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

4 Answers

up vote 4 down vote accepted

By default, I think crontab -e uses vi. So, after you've made your changes, hit Escape and type :wq then press Enter.

share|improve this answer
    
Perfect! It totally worked now. Appreciate your help, Christopher. –  krysis Aug 12 '11 at 20:21
1  
Also to start inserting text use the i key. –  Col Aug 12 '11 at 22:48
add comment

You can hit shift-zz to close and automatically save the file.

share|improve this answer
    
Nice, I like that! –  John Giotta Aug 12 '11 at 20:22
    
Similarly ZQ is equivalent to :q! –  glenn jackman Aug 12 '11 at 20:44
add comment

If your cron editor is vim, you would ESC and type :wq

share|improve this answer
    
Thanks to you too, John. –  krysis Aug 12 '11 at 20:21
add comment

As the correct answers here state, you need to save before crontab will parse your file and try to install your new edits. crontab, like many UNIX apps, checks the EDITOR environment variable for an editor, or then defaults to vi.

You can make it a bit easier by changing the editor you use:

EDITOR=kate crontab -e
EDITOR=gvim crontab -e

you get the idea....

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.