- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: cron and the end of month
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
10-03-2000 12:36 PM
10-03-2000 12:36 PM
One way would be to put multiple entries in cron, but due to the nature of my script this doesn't help me.
If this is not possible please let me know as well. This would be a nice UNIX enhancement.-----------Thanks,
Kirk Reindl
Unix Admin.
Milw, WI
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2000 12:49 PM
10-03-2000 12:49 PM
Re: cron and the end of month
Could it run at 00:00 on the first of the month?
If not then cron can't do it. However a solution is to get cron to run you job on the 28th, 29th, 30th and 31st and for your job to determine whether it should run or not.
The way I acheive that is to work out what tomorrow is with a simple C program and if it's the 1st then carry on, otherwise just exit the job.
If you search the forums for date related issues, I seem to remmber that sample C routines were posted some time ago. You could also do it with perl.
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2000 01:00 PM
10-03-2000 01:00 PM
Re: cron and the end of month
DAY='TZ=MST-17MDT date + %d'
if [ "$DAY" = "1" ]
then
do your stuff
fi
Depending on your TZ, make the necessary mods. What this is doing is going forward 24 hrs and looking what the date is. If the date is "1" then today is the last day of the month. If Feb 28 and tomorrow is Mar 1, the 1 will be returned and the test is true.
cron by itself will not do this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2000 01:01 PM
10-03-2000 01:01 PM
Re: cron and the end of month
DAY='TZ=MST-17MDT date + %d'
if [ "$DAY" = "1" ]
then
do your stuff
fi
Depending on your TZ, make the necessary mods. What this is doing is going forward 24 hrs and looking what the date is. If the date is "1" then today is the last day of the month. If Feb 28 and tomorrow is Mar 1, the 1 will be returned and the test is true.
cron by itself will not do this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2000 01:03 PM
10-03-2000 01:03 PM
Re: cron and the end of month
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2000 01:04 PM
10-03-2000 01:04 PM
Re: cron and the end of month
if [ "$DAY" = 01 ]
then
....
Also, drop the "" around the 01 in the test statement
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2000 05:52 PM
10-03-2000 05:52 PM
Re: cron and the end of month
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2000 07:20 PM
10-03-2000 07:20 PM
Re: cron and the end of month
We had similar situation, had no readymade option available with in Unix Cron. We will have to manipulate the date and time zone commands to come out of this. As Rick mentioned above setting the Timezone 24 hours ahead, so that you can check the next day date looks very impressive to me.
otherway is to schedule a cronjob for date 30 on month 4,6,9 and 11. Date 31 on month 1,3,4,7,8,10 and 12. and for date 28 on month 2.
During the leap year, you may have to change the date for month 2 entry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2000 05:21 AM
10-05-2000 05:21 AM
SolutionI have read the reply from Rick and I have been trying to run this script on my system with no sucess yet. My TZ is GMT0BST I have tried the following, but DAY is not being populated. Can you tell me how I should amend my script.
Hope you can help.
Dave
DAY=`TZ=GMT+24BST date + %d`
echo $DAY
if [ "$DAY" = 06 ]