- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Cron Reboot Script
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
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
тАО02-24-2003 11:03 AM
тАО02-24-2003 11:03 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:07 AM
тАО02-24-2003 11:07 AM
Re: Cron Reboot Script
If you want to run any command every 28th hust add the following line to the crontab:
30 5 28 * * command
-Tomek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:08 AM
тАО02-24-2003 11:08 AM
Re: Cron Reboot Script
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x9e2631ec5e34d711abdc0090277a778c,00.html
Scroll down to A. Clay Stephensons reply and grab his attached script, caljd.sh. That script is fast becoming the Forums standard for working with dates.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:08 AM
тАО02-24-2003 11:08 AM
Re: Cron Reboot Script
Search the forum for caljd.sh or caljd.pl.
This is Clay's excellent date hammer. This will do it for you.
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:10 AM
тАО02-24-2003 11:10 AM
Re: Cron Reboot Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:11 AM
тАО02-24-2003 11:11 AM
Re: Cron Reboot Script
I wonder why you would want to reboot the servers everymonth. You do not need to do it.
If it is insisted by the management (sometimes we can't help) then write a script that will shutdown the application. Something like this.
#!/usr/bin/ksh
command_to_stop_apps
if [ $? = 0 ]
then
/usr/sbin/shutdown -r now
else
echo "Application is not down" |mailx -s "${hostname) not rebooted" your_address
fi
Call this monthly_reboot.sh
Place an entry
30 05 28 * * /wherever/monthly_reboot.sh
into your root's cronjobs.
This will run the script every month on 28th at 5:30 AM.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:12 AM
тАО02-24-2003 11:12 AM
Re: Cron Reboot Script
That first response will run the command on the 28th of every month - not every 28 days. Use Clay's script to do it every 28 days. Believe you just need to run caljd.sh -u for usage notes.
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:19 AM
тАО02-24-2003 11:19 AM
Re: Cron Reboot Script
If "every 28 days" indeed means every 28th day increment as Jeff suggests, one way to accomodate this is to leverage 'at' with the "next timeunit" specification:
# at -f job-file time [date] [next timeunit|+count timeunit]
Thus, when your script runs, the last thing *it* does is to issue an 'at' request thereby rescheduling itself.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:20 AM
тАО02-24-2003 11:20 AM
Solution#Set GOOD_DAY between 0 and 27
GOOD_DAY=7
if [[ $(($(caljd.sh) % 28)) -eq ${GOOD_DAY} ]]
then
echo "Do your thing"
else
exit 0
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:22 AM
тАО02-24-2003 11:22 AM
Re: Cron Reboot Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:24 AM
тАО02-24-2003 11:24 AM
Re: Cron Reboot Script
THAT explains a lot.....
Later,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:27 AM
тАО02-24-2003 11:27 AM
Re: Cron Reboot Script
Your Windows management guy wants you to reboot every 28 days because that is what he has to do to keep his Windows servers running, right?
Show him this:
1:25pm up 1150 days, 1:41, 0 users, load average: 0.07, 0.07, 0.07
It is the actual uptime from one of our HP-UX servers. It hasn't been down for over three years now.
Next, he'll probably want you to automate the daylight savings time change. We can help you with that one too! ;)
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:34 AM
тАО02-24-2003 11:34 AM
Re: Cron Reboot Script
Anybody ever question the patch level of that server?
What do you tell them - that you're trying to set a record?
Cheers,
Jeff (UPTIME, baby...that's what we're talking about!)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:39 AM
тАО02-24-2003 11:39 AM
Re: Cron Reboot Script
There are two schools of thought on patching:
1. Patch it regularly.
2. Don't patch anything unless it is broken.
I'm in the first school, but this server is halfway across the country, and as long as it runs fine I don't want to mess with it. Besides, everytime our Windows guys start giving me a hard time here I just e-mail them the latest 'uptime' from that server and ask them, "Got Unix?"
Besides, remember that scene from "Blazing Saddles"?
"Patches? We don't need no steeenking patches!!" :)
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:44 AM
тАО02-24-2003 11:44 AM
Re: Cron Reboot Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:46 AM
тАО02-24-2003 11:46 AM
Re: Cron Reboot Script
Yep, I hear ya.
If I were you though, NEXT time it has to be rebooted, I'd have a replacement drive or two handy - just in case. Definitely, if it has to be power cycled.
Yea, that a funny line. Think it was first heard in an old John Wayne movie - Rio Lobo or Rio Bravo, I think.
"Badges?!?! We don't need no stinking badges!"
One of my favorites is in Three Amigos, I think, where these decrepit bandits are bandying about the term plethora - it's funny as hell.
Cheers,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:48 AM
тАО02-24-2003 11:48 AM
Re: Cron Reboot Script
Have a look at my first reply. Go to that thread and then go to A. Clay's response in that thread. The caljd.sh script is attached to his response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 11:50 AM
тАО02-24-2003 11:50 AM
Re: Cron Reboot Script
Here you go, although a search would have pulled up caljd.sh. Version 2.10 is the latest.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2003 12:20 PM
тАО02-24-2003 12:20 PM
Re: Cron Reboot Script
Anyway, I'm with the others that believe that rebooting a Unix server every 28 days (or on any regular basis) is something worthy of a Monty Python skit. This is a stable code base--no memory leaks (well, usually) that require a reset. I've got systems here that I actually forgot they existed because they require so little attention--uptime +400 days. We re-discovered them recently because we moved our data center, and somebody asked "Hey whats this?". The application, of course, was in Cobol, and used a flat file database with ISAM.
Why don't you ask the boss to see how long your system can go without a reboot?
Chris