Go Back   TechArena Community > Software > Operating Systems
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , ,

Sponsored Links



How to setup Cron Job via ssh

Operating Systems


Reply
 
Thread Tools Search this Thread
  #1  
Old 12-11-2009
Member
 
Join Date: Nov 2009
Posts: 103
How to setup Cron Job via ssh

I am trying to setup a Cron Job via SSH by running a php script. Can any one tell me that how should i setup a Cron Job? I do know the command required, but i don't know how to set the actual job up?
Reply With Quote
  #2  
Old 12-11-2009
Member
 
Join Date: Jan 2009
Posts: 1,741
How to setup Cron Job via ssh

To setup a Cron Job you should perform the following steps:-
1) nano /etc/crontab
2) 01 * * * * root run-parts /etc/cron.hourly
3) wget -O - -q -t 1 /path/to/cron.php
And if u want to make this run every two hours then you need to follow:
Quote:
01 * 2 * * root run-parts /etc/cron.hourly
I am not very much sure whether it will run every two hours or not but the path mentioned in the above command is correct.
Reply With Quote
  #3  
Old 12-11-2009
jesse's Avatar
Member
 
Join Date: Nov 2005
Posts: 2,965
How to setup Cron Job via ssh

First of all you need to create cron.hourly right file, which is known as script.cron. The path at the end of your crontab is the file or script, that you want to run. A job every two hours might look like this:
Quote:
0 0,2,4,6,8,10,12,14,16,18,20,22 * * * /path-to-script
and on some systems it will work like this:
Quote:
* */2 * * * /path-to-script
Reply With Quote
  #4  
Old 12-11-2009
Solomon's Avatar
Member
 
Join Date: May 2008
Posts: 4,056
How to setup Cron Job via ssh

There are 2 ways through which you can setup a Cron Job:

1) To setup a Cron job, you should not need an extension (.cron) if it is text file

the "crontab" command will automatically put it in the correct directory

The following command:
Quote:
bash$ crontab -l
will show you the current crontab. If You didn't get a crontab then, run the following command:

bash$ crontab /path/to/crontab or bash$ crontab /path/to/crontab.txt etc...

to check it run : bash$ crontab -l


2) Save your Crontab as a (plain) text file and name it "crontab" then,perform the following step:
open an SSH session, For listing your current crontab
Quote:
bash$ crontab -l
For removing (i.e. delete) your current crontab.
Quote:
bash$ crontab -r
For Setting the new crontab but check it with the "-l" parameter
Quote:
bash$ crontab /path/to/crontab
Reply With Quote
Reply

  TechArena Community > Software > Operating Systems


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to setup Cron Job via ssh"
Thread Thread Starter Forum Replies Last Post
Combining SSH and Cron void Software Development 3 06-08-2010 02:44 AM
Problem in using cron command Gunner 1 Windows Software 5 19-02-2010 01:25 AM
Cron jobs from a terminal GlassFish Windows Software 3 11-12-2009 02:58 PM
Running PHP Scripts with Cron klite Software Development 5 04-11-2009 08:26 AM
Cron no output !! Jabeen Software Development 3 13-07-2009 10:05 AM


All times are GMT +5.5. The time now is 12:14 AM.