0

I want to reboot my linux machine 2 minutes after it boots. I have the following listed in my crontab -e. All of these commands create the log files. but only ifc.log and sleep.log contain any entry. Reboot doesnt happen. What am i missing? What needs to change?

Reason : i am building a NAS server, i need to figure out if the hardware config works perfectly on every boot. This is for dev and testing purposes.

@reboot root sleep 100;  reboot >> /root/mylogs/cronrestart.log
@reboot root sleep 80;  echo "cron sleep 80" >> /root/mylogs/sleep.log
@reboot sleep 60; ifconfig >> /root/mylogs/ifc.log
@reboot sleep 61; lsusb >> /root/mylogs/lsusb.log
@reboot sleep 110; shutdown -r now >> /root/mylogs/junk.log
55597
  • 2,033
  • 1
  • 21
  • 40
  • just to confirm your requirement ... You want to have to machine reboot every 2 minutes (or so)? If not, then please rephrase the first sentence of your Q. If yes, then you may want to explain why you need/want to do this. Good luck. – shellter Oct 06 '16 at 14:07
  • @shellter Yes I want to reboot every two minutes. I am updating the question with the reason. Thank you. – 55597 Oct 06 '16 at 14:23
  • why do you have `reboot` and `shutdown -r now` ? Do things work better if you remove the `reboot > cronrestart.log` line? Good luck. – shellter Oct 06 '16 at 14:26
  • I wanted to see if any of the two works. Let me check if removing reboot helps. What confuses me is, I don't get the log for ifconfig but lsusb. – 55597 Oct 06 '16 at 14:28
  • see what happens after you remove `reboot` line. Also, for testing, I would use `ifconfig > /root/mylogs/ifc.log` etc (only one `>` char) so there is no question about when and what is those log files. Good luck. – shellter Oct 06 '16 at 14:32

0 Answers0