Home/Troubleshooting/My task on a remote Mac stopped overnight: how to check whether sleep caused it

My task on a remote Mac stopped overnight: how to check whether sleep caused it

Updated · airankrush

Symptom

The task was still running when you disconnected in the evening. The next day you connect and find it stopped long ago: no error, no new log lines after a certain time, or the program is no longer in the process list.

Possible causes (most common first)

  1. The program exited on its own: an error, being terminated by the system for running out of memory, or a sign-in session it depends on expiring. This is the most common cause, and the one most readily blamed on sleep.
  2. The task was attached to a terminal window and was ended together with it when the terminal closed or the remote session ended.
  3. The system went to sleep after being idle for a while and the process was suspended. After wake, some programs continue and some fail because their network connections timed out.
  4. The machine was restarted, for example by you or by some other operation.

Troubleshooting steps (easiest first)

  1. Check whether the machine actually slept

    Run pmset -g log | grep -E "Sleep|Wake" | tail -n 30 in Terminal to see recent sleep and wake records with their times. Compare them with the time of the last line in your task's log. Only if the times match was sleep the cause. If the machine has no sleep record for the whole night, look for the cause in the program itself. uptime tells you when the machine last started, which shows whether it was restarted.

  2. See how the program ended

    If the process is gone, read the last few dozen lines of its own log and its exit code. If you did not write its output to a file when starting it, there is nothing left to check this time; next time start it with >> ~/logs/run.log 2>&1 appended.

  3. Confirm sleep prevention is in effect

    pmset -g assertions lists which processes are currently preventing system sleep. After you start a task wrapped in caffeinate -i, a matching entry should appear here. According to the built-in manual page, -i prevents idle sleep and holds only while the wrapped command is running; it is released when the command ends. If the task is already running and it is too late to start it again, open another terminal and run caffeinate -i -w followed by that process's ID for the same effect.

  4. Detach the task from the terminal window

    If the cause was the terminal closing and not sleep, start the task inside a tmux session. The full steps are in the guide to keeping long tasks running and are not repeated here.

  5. Do not fix this by changing global power settings

    caffeinate affects only your own task and changes no system setting. System-level energy and lock screen options are tied to the delivery configuration; you may look at them, but ask support before changing them. Letting only the display turn off does not affect background tasks, and you do not need to do anything about it.

When to contact support directly

If the log shows the machine slept or restarted at a time when you did nothing, and you are sure you did not change the power settings, contact support on Contact support. Include your machine ID, roughly when the task stopped, the lines from pmset -g log for that period and the output of uptime. If you cannot connect and suspect the machine is asleep and will not wake, do not keep submitting restarts. Just state the last time you were able to connect.

Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support

Back to home · All troubleshooting pages