Monday, 29 March 2010

HOW to set up CRON JOB file using putty?

Using following step, you can set cronjob

1.) SSH or telnet into your account.
2.) At the prompt, type in 'crontab -e'. This will open up your crontab file, or create a new one if it doesn't exist.
When this file opens, you will see other cron jobs listed in here, or if you haven't any - you'll see a bunch of lines with '~' on them.
3.) Use the cursor to go down until you can't move the cursor down any more. This is where you start your new line. Press 'o' to insert a new line.
4.) Press 'o' to insert a new line. If you want to edit a line, press 'i'.
5.) Copy the code above, then right click into your SSH or telnet client to paste the above code in. This should all go in as a new line.
6.) Press the 'esc' key to exit out of edit mode.
7.) To save the changes and exit, type the following in: ZZ
If you want to exit without saving changes, type in: :q!




# Minute   Hour   Day of Month       Month          Day of Week        Command    
# (0-59)  (0-23)     (1-31)    (1-12 or Jan-Dec)  (0-6 or Sun-Sat)                
    0        2          12             *               0,6           /usr/bin/php /vr/www/html/vpe/mail.php
30 23 * * * /usr/bin/php /var/www/html/vpe/mail.php  

that means above cron will run daily at 23:30 i.e., 11:30 PM 
and you'r done.

Cheers!

8 comments:

  1. This is the ultimate solution I find.Finally this works.Thanks so much.

    I just change the 'user to usr' from the above line.

    Debraj Mandal
    Php Team Leader

    ReplyDelete
  2. Its really good!! Thanks

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Really Helpful it is
    Thanks Bro

    ReplyDelete
  5. How to delete some texts on crontab? I already try using shift+backspace, but it cannot work. Could you give some advice? Thank you~

    ReplyDelete