![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| cron tab setting | Kbharat20 | SUN Solaris | 1 | 05-16-2008 08:48 PM |
| cron job setting | jaydeep_sadaria | Shell Programming and Scripting | 2 | 11-21-2007 07:07 AM |
| Listing and setting up cron jobs | NycUnxer | UNIX for Dummies Questions & Answers | 3 | 11-08-2007 06:45 PM |
| Setting environment variables within cron jobs!! | atheek | SUN Solaris | 1 | 10-09-2006 04:26 AM |
| Cron not retaining TERM setting | steelrose | UNIX for Dummies Questions & Answers | 2 | 10-14-2005 11:01 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Greetings i am a newbie to this so kindly bear with me. I have a script to get weather information from a site and save that into a database.
Code:
wget Cranfield Weather Forecast temp = $(cat wx.php | grep -o "Temperature.......") rm wx.php mysql -D "weather_wise" -e "insert into weather (date,hour,degrees) values (now(),now(),$temp)"; 0 00-23 * * 0-7 command ? Last edited by Yogesh Sawant; 03-31-2008 at 08:01 AM. Reason: added code tags |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
what is your condition to run the scripts.....e.g. when at what time the scripts needs to invoke.
before that check whether your cron deamon(crond) is running or not, if running setting up cron will not make an issue, if not then try to invoke that one , then set your cron, with absolute path, will work fine. |
|
#4
|
|||
|
|||
|
crons
User defined crons have to be created using the command crontab -e
set your cron accordingly 30 14 * * * <your file (eg.sh weather)> | | | | |_____ Day of the week(0-6) | | | |_______ Month (1-12) | | |_________ Day of the Month (1-31) | |___________ Hour of the Day (0-23) |______________ Minutes (0-59) cron start --start your cron cron stop --stop your cron |
|
#5
|
||||
|
||||
|
I use this header at the top of the crontab file to make it easier when reading.
Code:
#Minute (0-59), #| Hour (0-23), #| | Day of the month (1-31), #| | | Month of the year (1-12), #| | | | Day of the week (0-6 with 0=Sunday). #| | | | | Commands #| | | | | | #------------------------------------------------------------------------------------------------------- Code:
# sudo crontab -l #ident "@(#)root 1.21 04/03/23 SMI" # # The root crontab should be used to perform accounting data collection. # # #Minute (0-59), #| Hour (0-23), #| | Day of the month (1-31), #| | | Month of the year (1-12), #| | | | Day of the week (0-6 with 0=Sunday). #| | | | | Commands #| | | | | | #------------------------------------------------------------------------------------------------------- 10 3 * * * /usr/sbin/logadm 15 3 * * 0 /usr/lib/fs/nfs/nfsfind 30 3 * * * [ -x /usr/lib/gss/gsscred_clean ] && /usr/lib/gss/gsscred_clean |
|
#6
|
|||
|
|||
|
0 00-23 * * 0-7
Try 0-6 not 0-7? |
|
#7
|
|||
|
|||
|
Help with wget
Help Inserting data in mysql table Is that you, or does it just look a lot like you? Is this a homework assignment where all of you were directed to this site for help? For what it's worth, those threads have more elegant solutions for getting the temperature from the web site. You should avoid using a temporary file, and you should avoid cat file | grep when just grep file works fine. |
|||
| Google The UNIX and Linux Forums |
| Tags |
| cron, wget |
| Thread Tools | |
| Display Modes | |
|
|