LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-29-2010, 12:44 AM   #1
saran_redhat
Member
 
Registered: May 2009
Location: chennai
Posts: 247

Rep: Reputation: 16
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.
 
Old 06-29-2010, 01:06 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,550

Rep: Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898
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.
 
Old 06-30-2010, 10:18 AM   #3
saran_redhat
Member
 
Registered: May 2009
Location: chennai
Posts: 247

Original Poster
Rep: Reputation: 16
cron job

Quote:
Originally Posted by grail View Post
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.
 
Old 06-30-2010, 11:34 AM   #4
hanzerik
Member
 
Registered: Jan 2002
Location: Cheyenne Wyoming
Distribution: Debian/Raspbian/Mint
Posts: 717

Rep: Reputation: 32
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

Last edited by hanzerik; 06-30-2010 at 11:53 AM.
 
Old 07-01-2010, 04:55 AM   #5
saran_redhat
Member
 
Registered: May 2009
Location: chennai
Posts: 247

Original Poster
Rep: Reputation: 16
cron job

Quote:
Originally Posted by hanzerik View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron appears to be messed up (E: cron: subprocess post-installation script returned e bujutsukai Linux - Newbie 1 07-24-2008 04:39 AM
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 09:09 AM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 09:16 AM
help: using cron + my bash script --> don't want mail from script beeblequix Linux - General 7 11-23-2007 10:25 PM
PPPD Script problem when cron-scheduling the script andresurzagasti Linux - Networking 0 11-24-2004 03:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration