LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cron Script (https://www.linuxquestions.org/questions/linux-newbie-8/cron-script-816914/)

saran_redhat 06-28-2010 11:44 PM

Cron Script
 
Hai Friends

in my linux box i have lot of cron jobs. i need to make all cron jobs in script files. is it possible to make this. like

30 5 * * * wget -q http://www.example.com/site/psychren...automation.htm
45 23 * * *wget -q http://www.example.com/site/updatebo...sionstatus.htm

Now how i change this in a script file. please advise me.

grail 06-29-2010 12:06 AM

Quote:

i need to make all cron jobs in script files
Please explain a little further what you require?

Are you asking if you can put the following into a script?
Code:

wget -q http://www.example.com/site/psychren...automation.htm
Then the answer is yes, just as is would be fine.

saran_redhat 06-30-2010 09:18 AM

cron job
 
Quote:

Originally Posted by grail (Post 4017855)
Please explain a little further what you require?

Are you asking if you can put the following into a script?
Code:

wget -q http://www.example.com/site/psychren...automation.htm
Then the answer is yes, just as is would be fine.


Thanks for reply.

Yes i need to put in a script file.

hanzerik 06-30-2010 10:34 AM

Might want to do it like this so you know exactly where the file is going to be downloaded to:
Code:

30 5 * * * wget -q http://www.example.com/site/psychrenewalstatusautomation.htm -o /home/YourName/psychrenewalstatusautomation.htm
Are these going to be run by a user cronjob, or as a system cronjob? If you are going to be running then as a normal user, then make a directory in your home folder called bin i.e; /home/hanzerik/bin
Then create a file in there called something like MyWgetJobs.sh
Code:

#!/bin/bash
wget -q http://www.example.com/site/psychrenewalstatusautomation.htm -o /home/yourname/psychrenewalstatusautomation.htm
wget -q http://www.example.com/site/updatebothabsentsessionstatus.htm -o /home/yourname/updatebothabsentsessionstatus.htm
exit

Put all of your wget statements in that MyWgetJobs.sh, save it, then make it executable (chmod 755 $HOME/bin/MyWgetJobs.sh).
Now just create one CRON job to run the MyWgetJobs.sh script.
Code:

30 5 * * * /home/yourname/bin/MyWgetJobs.sh

saran_redhat 07-01-2010 03:55 AM

cron job
 
Quote:

Originally Posted by hanzerik (Post 4019507)
Might want to do it like this so you know exactly where the file is going to be downloaded to:
Code:

30 5 * * * wget -q http://www.example.com/site/psychrenewalstatusautomation.htm -o /home/YourName/psychrenewalstatusautomation.htm
Are these going to be run by a user cronjob, or as a system cronjob? If you are going to be running then as a normal user, then make a directory in your home folder called bin i.e; /home/hanzerik/bin
Then create a file in there called something like MyWgetJobs.sh
Code:

#!/bin/bash
wget -q http://www.example.com/site/psychrenewalstatusautomation.htm -o /home/yourname/psychrenewalstatusautomation.htm
wget -q http://www.example.com/site/updatebothabsentsessionstatus.htm -o /home/yourname/updatebothabsentsessionstatus.htm
exit

Put all of your wget statements in that MyWgetJobs.sh, save it, then make it executable (chmod 755 $HOME/bin/MyWgetJobs.sh).
Now just create one CRON job to run the MyWgetJobs.sh script.
Code:

30 5 * * * /home/yourname/bin/MyWgetJobs.sh


Hai


Thank you for the help


All times are GMT -5. The time now is 11:25 AM.