- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: how to schedule job in crontab?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 09:49 PM
тАО07-22-2009 09:49 PM
how to schedule job in crontab?
how to schedule job in crontab for every 40 mins?
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 11:29 PM
тАО07-22-2009 11:29 PM
Re: how to schedule job in crontab?
make your crontab some thing like this:
0 0,3,6,9,12,15,18,21 * * *
40 1,4,7,10,13,16,19,22 * * *
20 2,5,8,11,14,17,20,23 * * *
Hope it will work as you want..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 01:02 AM
тАО07-23-2009 01:02 AM
Re: how to schedule job in crontab?
Under /var/spool/cron/crontabs/
each user will have there own jobs. You may use the command
crontab -e and just put the entry like
# min 0-59 hour0-23 date1-31 month1-12 day0-6 command
You may see the examples given by Fayez
* Make sure that cron deamon is running
* /var/adm/cron/cron.allow and cron.deny is cofigured like the user can crate cronjobs.
crontab -r = Remove all your scheduled cronjobs:
crontab -l =
View your cronfile:
For making cron you may use
Edit and submit a cronfile:
# crontab-e
make sure that your editor variable is set for using the switch "e".
Regards,
Sooraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 02:25 AM
тАО07-23-2009 02:25 AM
Re: how to schedule job in crontab?
# export EDITOR=vi
# crontab -e
where username would be the user through which you would want to run the cron job every 40 mins. e.g. root
Insert a new line entry such as below :
40 * * * *
Note : Ensure you maintain an equal space between arguments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 02:30 AM
тАО07-23-2009 02:30 AM
Re: how to schedule job in crontab?
This document might be of additional assistance to you.
http://www.docs.hp.com/en/5991-6469/ch09s04.html
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 04:39 AM
тАО07-23-2009 04:39 AM
Re: how to schedule job in crontab?
It is not good manner to leave your thread without replaying to people response, and without points, at least if response did not help, just tell so we can continue helping you.
If you keep like this in every thread you open, no one will help you in future. Sorry!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 04:48 AM
тАО07-23-2009 04:48 AM
Re: how to schedule job in crontab?
-and-
"40 * * * *
runs the job once an hour at 40 minutes after. Note the original request was "every 40 minutes". If that truly means you want 40 minutes to elapse between runs, the above isn't going to work.
Perhaps a bit of clarification is in order here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-24-2009 12:44 AM
тАО07-24-2009 12:44 AM
Re: how to schedule job in crontab?
There is an Online document addressing EXACTLY what you might be looking for at
WITH EXAMPLES at
http://docs.hp.com/en/B2355-90164/apcs01.html
COPY PASTE FROM ABOVE LINK BELOW
<<
You can use the crontab command to run commands at regular intervals. For example, you can send a weekly e-mail reminder for a meeting to your mailbox, or erase all "tmp" files everyday.
The crontab command creates a file called by your username in the directory /var/spool/cron/crontabs. The commands in the file are executed at the specified intervals in your home directory.
A crontab file contains line with six fields each separated by spaces or tabs. The first five fields specify the time the command will be run
minute (0-59)
hour (0-23)
date of the month (1-31)
month of the year (1-12)
day of the week (0-6 with 0=Sunday)
The sixth field is a string that is executed at the appropriate time.
To create a crontab command file, enter:
$ crontab
Then type the commands you want to schedule and press Ctrl-D.
30 8 * * 4 echo "Staff meeting today at 10:00 AM"
0 0 * * * rm *.tmp 2 > errfile
Ctrl-D
The crontab file is interpreted as follows:
On Thursday at 8:30 AM, crontab sends you a reminder of your 10:00 AM staff meeting. The first field (30) indicates 30 minutes after the hour. The second field indicates the hour (8). The asterisks mean all legal values. The 4 means Thursday.
At midnight everyday, crontab erases files with a *.tmp extension in your directory. Error messages are redirected to a file called errmsg in your home directory.
List crontab
To list your current crontab entries, use the -l option.
$ crontab -l
<<<<<<<<<<<<<<<<<<<<<
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-24-2009 02:11 AM
тАО07-24-2009 02:11 AM
Re: how to schedule job in crontab?
i read it again and it's a very good question
your cron job would run after the following intervals
40 mins
80 mins
120 mins
so if you translate it into a time for argument sake this is what we get
1.40PM
2.20PM
3.00PM
3.40PM
4.20PM
5.00PM
5.40PM
6.20PM
7.00PM
7.40PM
8.20PM
9.00PM
Do you see a pattern so you have to write three cron jobs
minute The minute of the hour, 0-59
hour The hour of the day, 0-23
monthday The day of the month, 1-31
month The month of the year, 1-12
weekday The day of the week, 0-6, 0=Sunday
, to specify time as a number
- to give a range of time
* includes all the valid values in the feild
40 1,3,5,7 * * * echo "40 mins every odd hour"
the above line in crontab would run echo command at 01:40 PM - 03:40PM - 05:40PM - 07:40PM
20 2,4,6,8 * * * echo "20 mins every even hour"
the above line in crontab would run echo command at 02:20 PM - 04:20PM - 06:20PM - 08:20PM
00 3,5,7,9 * * * echo "run this every even hour"
the above line in crontab would run echo command at 03:00 PM - 05:00PM - 07:00PM - 09:00PM
this way you get to run this job every 40 mins - ofcourse you might want to replace the echo command with the relevent job's
<<< Please don't forget to assign points >>>>>>>>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-24-2009 08:13 AM
тАО07-24-2009 08:13 AM
Re: how to schedule job in crontab?
a) if found delete it an exit w/o processing
b) if not found create it and process
Of course, the operations could be swapped, as in
c) if found, process and delete
d) if not found, delete and exit