- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- crontab problem
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
Forums
Discussions
Discussions
Discussions
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
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
11-05-2002 01:49 AM
11-05-2002 01:49 AM
crontab problem
run on the first day of every month (1st ) and every Monday , but if the 1st is Monday, then the job process one time only (cos i don't wanna have duplicate processing) , is it possible? Thx.
eg.
crontab 1 (single script):
00 09 1 * 1 -- > run on 1st AND Monday only , so not fit my requirement.
Crontab 2 (double script):
00 09 1 * *
00 09 * * 1 --> if the 1st is Monday , then it will run two processes (duplicated)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2002 01:53 AM
11-05-2002 01:53 AM
Re: crontab problem
00 09 1 * 1 jobname.sh
will run the job every Monday AND the first day of the month. This should not run twice on Monday the first!
man page of crontab for perusal,...
If both are specified in an entry, they are cumulative. For example,
0 0 1,15 * 1 command
runs command at midnight on the first and fifteenth of each month, as
well as every Monday.
Share and Enjoy! Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2002 02:03 AM
11-05-2002 02:03 AM
Re: crontab problem
thx r reply, but my first statement not fit my requirement cos it only run on the 1st of the month AND Monday ( meet the both conditions) , my requirement is run on 1st day of month OR every Monday (meet anyone of condition is ok), sorry to make you confused. Thx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2002 02:33 AM
11-05-2002 02:33 AM
Re: crontab problem
as Ian said
00 09 1 * 1 is cumulativ, this script runs
- first day of month
- every monday
- if the first day of month is a monday the script runs only once
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2002 02:41 AM
11-05-2002 02:41 AM
Re: crontab problem
You want the job to run every Monday
You want the job to run on the first of every month
When the first of the Month is a Monday, you do not want the job to run twice.
Correct?
Crontab 1 in your original posting should provide for this. Have you tested this crontab entry to see what is happening?
I have tested the following crontab entry just now,...
37 10 5 * 2 /tmp/test.sh
The script has run only once on a Tuesday the 5th of Nov.
39 10 5 * 0 /tmp/test.sh
The script ran once on the 5th of Nov, even though Sunday was configured.
41 10 3 * 2 /tmp/test.sh
The script ran once on a Tueday, even though the 3rd of Nov was configured
Conclusion - Crontab allows multiple parameters to be specified, and will run the command on each and every matching parameter.
Using words like OR and AND is causing confusion I think.
Why not try this at home?
Share and Enjoy! Ian Dennison
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2002 03:09 AM
11-05-2002 03:09 AM
Re: crontab problem
+++
Note that the specification of days can be made in two fields: monthday and weekday.
If both are specified in an entry, they are cumulative. For example,
0 0 1,15 * 1 command
runs command at midnight on the first and fifteenth of each month, as well as every Monday.
+++
Your crontab entry will do the job :
- every first day in month AND
- every Monday
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2002 03:57 AM
11-05-2002 03:57 AM
Re: crontab problem
Just how disrespectful and ungrateful can you be? IN SIX MONTHS? YOU have got to be KIDDING ME!
This member has assigned points to 190 of 474 responses to his/her questions.
Read this:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x376efd3f91d3d5118ff40090279cd0f9,00.html
then find your previous questions here:
http://forums.itrc.hp.com/cm/TopSolutions/1,,CA759973!1!questions,00.html
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2002 04:02 AM
11-05-2002 04:02 AM
Re: crontab problem
It seems as this needs two crontab scripts both doing the same job but the script that runs the first of evry month checks if the day is monday and if this is true exits without doing anything.
This can be done with a test condition using
"date -u +%a"
If this returns "Mon", do nothing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2002 06:16 AM
11-05-2002 06:16 AM
Re: crontab problem
Darrell