- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Crontab question...
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-02-2006 07:16 PM
07-02-2006 07:16 PM
I would like reboot automatically a server all the first sunday of the month.
I have added this line in root's crontab:
00 06 1-7 * 0 /usr/sbin/shutdown -r -y 0
But my server has rebooted July first on July 2 and on July 3... cron didn't hold account of "0" Sunday...
Someone can help me ?
Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2006 07:32 PM
07-02-2006 07:32 PM
Solution- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2006 07:35 PM
07-02-2006 07:35 PM
Re: Crontab question...
With the schedule that you have, it will reboot your machine if the date is the 1st, 2nd, 3rd, 4th, 5th, 6th, 7th OR if it is Sunday (ANY Sunday).
In order to do what you want to do you need to build some "smarts" into your script. You can do it a couple of different ways:
1) Run your script every day the first 7 days of the month. Have a piece of code in the script check to see if it is Sunday. If it is, reboot. If it's not, don't do anything.
2) Run your script every Sunday and have your script check to see if it is the first Sunday (the date is somewhere in the range of 1 - 7). If it is, reboot, if not, don't.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2006 08:03 PM
07-02-2006 08:03 PM
Re: Crontab question...
Or create multiple entries in the crontab.
00 06 06 08 * /usr/sbin/shutdown -r -y 0
00 06 03 09 * /usr/sbin/shutdown -r -y 0
00 06 01 10 * /usr/sbin/shutdown -r -y 0
00 06 05 11 * /usr/sbin/shutdown -r -y 0
00 06 05 11 * /usr/bin/mailx -s "Renew reboot cron Entries!" admin@xyz.com
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2006 08:09 PM
07-02-2006 08:09 PM
Re: Crontab question...
Thanks to all !!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2006 04:22 AM
09-01-2006 04:22 AM
Re: Crontab question...
00 17 * * 0 if [ `/bin/date +\%d` -le 7 ]; then /usr/sbin/shutdown -r -y 0 ; fi
This will reboot only the first Sunday of the month at 5pm local time. It seems... cleaner than some of the other solutions.
Regards,
Greg