- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- execute end of month..cronjob
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
07-10-2002 10:37 PM
07-10-2002 10:37 PM
Feb has 28th, and each of month has 30, 31 respectively..
who could give the answer..?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2002 10:59 PM
07-10-2002 10:59 PM
Solutionthis question has already been raised a couple of times, so RTFF!!
anyway:
define a job in your crontab to run on days 28-31:
put this little test in your script:
if test `TZ=MET-24 date +%d` = 01
then
last day of month --> continue
else
not last day of month --> exit
fi
good luck,
Thierry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2002 11:02 PM
07-10-2002 11:02 PM
Re: execute end of month..cronjob
Sir A. Clay Stephenson's caljd.sh script fixes all of these date problems. Try this link.
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x6e7a7d4cf554d611abdb0090277a778c,00.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2002 01:51 AM
07-11-2002 01:51 AM
Re: execute end of month..cronjob
Here's an easy way using 'cal':
# cal|awk 'NF>0 {D=$NF} END{print D}'
...IF 'D' is the same as the current day, then it's the last day of the month. This works for leap years, too, as for instance:
# cal 02 2000|awk 'NF>0 {D=$NF} END{print D}'
As for the trick using 'TZ', my European friends living around the Prime Meridian are the "lucky" ones who can use +-24 hours to exactly compute yesterday or tommorrow including the correct time.
If you look at the man pages for environ (5) you will note that offset is the value that must be added to local time to arrive at UTC (GMT). Offset has the format hh[:mm[:ss]], where (hh) is any value from 0 through 23. The optional minutes (mm) and seconds (ss) fields are a value from 0 through 59. The hour field is required. If the offset is preceded by a -, the time zone is east of the Prime Meridian. A + preceding the offset indicates that the time
one is west of the Prime Meridian.
Notice, for example, though, that at 1100 hours on July 11 in the Eastern US, you cannot produce a date *and time* exactly 24-hours ago. To affect this, the computation would need to offset 28 hours (24+4), an invalid offset.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2002 05:50 PM
07-11-2002 05:50 PM
Re: execute end of month..cronjob
`date -d tomorrow +%d` == 01
for end of month
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2002 08:32 PM
07-11-2002 08:32 PM
Re: execute end of month..cronjob
thanks your answer again!
best regards.