LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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-28-2010, 11:44 PM   #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, 12:06 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
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, 09: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, 10: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 10:53 AM.
 
Old 07-01-2010, 03: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



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 03:39 AM
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM
help: using cron + my bash script --> don't want mail from script beeblequix Linux - General 7 11-23-2007 09:25 PM
PPPD Script problem when cron-scheduling the script andresurzagasti Linux - Networking 0 11-24-2004 02:54 PM

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

All times are GMT -5. The time now is 04:10 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
Open Source Consulting | Domain Registration