0

While trying to cancel an automatic shutdown, I used the following inTerminal:

* * * * * /sbin/shutdown -h now

Most probably I entered it within:

crontab -e

Hoping that by not giving any time the shutdown would not happen... Big mistake! Now the computer does not turn on any more.

Do you have any suggestion to fix that in Recovery Mode or Single-User Mode?

  • 1
    I love the logic: I don't want it to shutdown at a specific time anymore, so I'll set it to shutdown all the time. – JBis Aug 25 '18 at 4:00
  • 1
    Try booting to safe mode. – JBis Aug 25 '18 at 4:04
  • 1
    This line, as you copied it in your original question cannot do any damage exept an error message, typically: bash: command not found: Applications.Where exactly did you enter this line? Were you root at this time? – dan Aug 25 '18 at 7:53
  • 1
    @danielAzuelos It’s almost certain Sbor was in crontab -e or editing the cron file and in their panic to post for help didn’t think through the details we’d need to help them. I expect an edit soon from them to clarify what precisely they did if my answer doesn’t help them self rescue. As you point out, they had to do lots of things in terminal before pasting/typing * * * * * /sbin/shutdown – bmike Aug 25 '18 at 23:21
  • 1
    Thanks all! Booting in safe mode disnt work; in single-user mode I only had a “read only” mode. I went the easiest way and used time machine backup. – SBor Aug 26 '18 at 16:44
3

If I guess correctly you probably entered the line:

* * * * * /sbin/shutdown

in the root crontab with the command crontab -e when in priviledged mode (running as root).

The simplest way to get out of this shutdown every minute is as follows:

  1. Boot your Mac in single-user mode: immediatly after powering it on, hold on +S until you get white text on a black screen.
  2. Once you see the shell prompt, beware: you are root, everything you type might destroy your system, enter the following command:

    /sbin/mount -uw /
    

    (== remount the / filesystem in write mode) so as to be able to modify the root crontab which is on the / filesystem

    /usr/bin/crontab -e
    

    which will let you edit your root crontab file, go to the line containing exactly (it might be the uniq line):

    * * * * * /sbin/shutdown
    

    and an editor should open (from memory, it should be vi but I'm only 50% sure) delete it (in vi: dd), save your file and exit(in vi: :wq).

  3. Type /sbin/reboot to restart your system without the deadful crontab line.

  • 1
    Do you need to mount the filesystem write mount -uw / or has something changed? – fd0 Aug 26 '18 at 17:21
  • Thank you. I improved my answer with your key detail 😊! – dan Aug 26 '18 at 21:14
1

Yes - boot to recovery HD or OS and then look for the terminal utility in the menu. You will be able to edit the crontab file to remove that entry and chill out the over active shutdown process.

Even easier would be to boot your Mac in target disk mode and edit the file from another Mac that’s running and can connect to your storage as if it’s an external drive.

Worst case, you can restore from a backup before the system got the wrong instructions you didn’t realize would be painful. There’s going to be no data loss since you can’t work on anything after this change was made. Time Machine even might have a local backup you can roll back, so be sure to check that if you can’t fix things in recovery mode.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .