- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Creating a crontab to server reboot
Categories
Company
Local Language
Forums
Discussions
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
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
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
03-20-2007 05:30 PM
03-20-2007 05:30 PM
I want to reboot a server on first monday of every month any one can help me in this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2007 05:48 PM
03-20-2007 05:48 PM
SolutionRefer to the below thread. same issue is discussed in it. the only difference is it is sunday instead of monday :)
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1096366
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2007 06:25 PM
03-20-2007 06:25 PM
Re: Creating a crontab to server reboot
cron can't do it by itself.
You need to run a script every monday and use one of these two scripts to determine if its the first monday and therefore to boot.
http://hpux.ws/merijn/caljd-2.25.sh
http://hpux.ws/merijn/caljd-2.2.pl
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2007 03:11 PM
03-21-2007 03:11 PM
Re: Creating a crontab to server reboot
---------------------
#!/sbin/sh
DAYOFWEEK=`/usr/bin/date +%u`
DATE=`/usr/bin/date +%d`
if [ ${DAYOFWEEK} -eq "1" ] && [ ${DATE} -lt '8' ]
then
echo "rebooting server"
/usr/bin/cd /
/usr/sbin/reboot
fi
---------------------
What it will do:
-> find out if the day is Monday and date is less than 8 (ie first Monday)
-> if yes, cd to root and perform reboot
Cheers,
Pau Cen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2007 03:33 PM
03-21-2007 03:33 PM
Re: Creating a crontab to server reboot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2007 10:14 PM
03-21-2007 10:14 PM
Re: Creating a crontab to server reboot
Second, a little caution about the script from Pau Cen:
You don't want to use the reboot command. That will cause an immediate halt of the system. What you probably would prefer to do is a graceful shutdown initiated by the shutdown command "/usr/sbin/shutdown" and you probably want to add the "-r" option so it will reboot. So you want "/usr/sbin/shutdown -r".
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2007 10:31 PM
03-21-2007 10:31 PM
Re: Creating a crontab to server reboot
Unattended reboots are not found in the Best Practices list of a good system administrator.
Any reason that you consider it important for your environment?
revert
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2007 01:00 PM
03-22-2007 01:00 PM
Re: Creating a crontab to server reboot
> about the script from Pau Cen:
>
> You don't want to use the
> reboot command. That will cause
> an immediate halt of the system.
> What you probably would prefer to
> ...
Pete, I second what you said. I myself won't put reboot in any script on my production machine - I put reboot in the sample script above just because Jollyjet mentioned in the question "...I want to reboot a server...".
I agree with Clay & Yogeeraj as well that unattended reboots are not a good practice (especially on a production system).
The script was provided under an assumption that the user knows what he/she does.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2007 09:19 PM
03-22-2007 09:19 PM
Re: Creating a crontab to server reboot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2007 10:26 PM
04-01-2007 10:26 PM