What would happen if you use:

sudo crontab -e

And add the line:

@reboot reboot

Will it go into a infinite loop of rebooting?!

  • 4
    let's test it :) – Maythux Jul 21 '15 at 10:36
  • 1
    Why not? Do you think the reboot command is special? – muru Jul 21 '15 at 10:39
  • 2
    If not, it's a bug ;-) – Rmano Jul 21 '15 at 10:39
up vote 20 down vote accepted

Testing result:

If you add

@reboot reboot

This did not work!!! Why?

$ which reboot
/sbin/reboot

Now When i added the full path of reboot, the cron job runs normally.

So you got an infinite loop of rebooting in the case:

sudo crontab -e

And add the line:

@reboot /sbin/reboot

EDIT:

If you want to get rid off this, you probably need to boot from an Live CD, then mount your disk drive and go to the cron file and remove the added line.

sudo gedit /media/some-UUID/var/spool/cron/crontabs/root

Save and then remove livecd and reboot again, and you'll be safe

  • 4
    Just for the extra service we always provide: it would be nice to include a method where you can remove this alteration ;) – Rinzwind Jul 21 '15 at 11:57
  • Yea, that would be the next question! If you do this, how can you gain back control? – PascalVKooten Jul 21 '15 at 13:35
  • 2
    Good one. I always said CS is an experimental science. ;-) – ALAN WARD Jul 21 '15 at 14:02
  • 2
    @Maythux should also be possible from grub (drop to console mode and nano it out of tje crontab ;) ) – Rinzwind Jul 21 '15 at 14:51
  • 1
    For the OP, remember that you can safely test these things in a VM (virtual machine), e.g. VirtualBox. – Paddy Landau Jul 28 '15 at 13:43

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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