0

im gonna reboot my server 6am every day, if my internet get disconnected and DDOSed. Does anyone have an idea how to do the command "at" at a specific time, and "AM"? Thanks- My computer clock doesnt have AM/PM, but I suppose linux wont understand if I write 06:00, will it be on mornings or on evenings?........

(I tried this for a test: echo "reboot" | at 23:17pm today), but it says "Unknown pm". What should i do?

Thanks

  • Have you seen Ubuntu's Scheduled Tasks gui? – user29020 Jul 16 '14 at 19:09
2

You don’t need the PM because there is no 23:17am

Its a 24hr clock so just write it in 24hr format you cannot go wrong.

stephenm@mcr:~$ sudo at 6:00 tomorrow
[sudo] password for stephenm: 
warning: commands will be executed using /bin/sh
at> reboot
at> <ctrl+d>
job 4 at Sun Sep 22 06:00:00 2013
1

You most likely need crontab Logon to the server and type sudo crontab -e. In this instance, the root user will run the command at 6AM enter your password Select your preferred text editor - for example type 2 for nano. Create a new line on the bottom of the file and type * 6 * * * YOUR COMMAND HERE

Obviously replace YOUR COMMAND HERE with your command, however in your case this will be reboot

Exit and save The server will now reboot every 6AM

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.