Command: nosleep
Prevent the system from sleeping, using the built-in caffeinate
utility.
Usage
Usage: m nosleep [OPTION] [ARGUMENTS]
Description: Simple script to prevent the system from sleeping.
Options:
--help Show this help message and exit
--until SECONDS|SCRIPT|PID Prevent sleep until the specified time in seconds, until a script finishes, or until a process with the given PID ends.
Options
--until
Prevents the system from sleeping for a specific duration or until a specific process completes.
SECONDS
: A number representing the duration in seconds to prevent sleep.SCRIPT
: A command or script to execute.nosleep
will prevent sleep until the command finishes.pid PID
: A process ID.nosleep
will prevent sleep until the process with that PID exits.
Examples:
# Prevent sleep for one hour (3600 seconds)
m nosleep --until 3600
# Prevent sleep while a long-running backup script executes
m nosleep --until ./my_backup_script.sh
# Prevent sleep until process with PID 12345 exits
m nosleep --until pid 12345