Better to use "at" command instead of time variable in shutdown?
OK, I was reading that if I want to do a one time scheduled command, I should use at, which I've never done, as opposed to cron, which i'm kinda familiar with. But what I want to do is reboot my server at 3am tomorrow and force it to check the file systems with a shutdown -rF.
For this do I even need to use "at" or could I just say shutdown -rF 3:00 Will that also know that I mean 3am tomorrow and not say in 3 minutes from now or 3pm? I never done this before so I'm kinda paranoid, just looking for some confirmations from the experts so I don't really screw something up. thanks in advance. |
Indeed it is not specified in the man page, but hour is in 24h format. Confirmation from the source code:
Code:
/* Time in hh:mm format. */ |
This is from the shutdown man page:
Quote:
|
Thanks for confirming colucix. I didn't see it in the man page either so wanted to ask.
so guess me doing a shutdown -rF 3:00 will indeed restart and force a disk check on all partitions at 3am tomorrow. |
Quote:
|
my other problem is I don't know how to use at, could someone help me?
|
It's there in the man page in black and white. So, use the shutdown command without at at your own risk. If it does cause problems with user logins, you can always kill the pending shutdown, which put you back at square one: do I or don't I schedule shutdown with or without at.
I can't think of anything else to say about it. For examples using at: http://www.kombitz.com/2009/09/17/li...d-at-examples/ www.google.com/linux is your friend. Use it to search for answers to questions you have about GNU/Linux. |
Well.. the man page also does not mention that /etc/nologin is created 5 minutes before shutdown. Again the source code comes in handy:
Code:
if (wt <= 5 && !didnolog) { |
OK, so as long as I just do a shutdown -rF 3:00, it will allow new SSH sessions up until 5 minutes before the reboot. That's a pretty nifty little feature they have hidden in there, I never would have know about it.
I'm using RHEL, would it vary between distros or is there something I should check on my server? Thanks for all the help colucix, I'm learning a lot here. |
Quote:
|
I'm sorry, but I dont know how to check that to tell you.
|
Code:
rpm -qf /sbin/shutdown |
Here's what mine said when i issued the command you said.
SysVinit-2.85-4.4 |
Ok. I confirm the /etc/nologin appears 5 minutes before shutdown time! :)
|
Great. Thanks colucix. Now I just have to figure out how if when it goes to shutdown if it has a kernel panic, how to get it to skip over it and continue the reboot and forced disk check. that way the server isn't sitting there doing nothing for hours before i get in.
|
All times are GMT -5. The time now is 07:10 AM. |