This repository contains scripts to schedule either sleep or shutdown for macOS, Linux, and Windows devices. Each script provides a countdown and the ability to abort the planned action.
- User can choose between putting the device to sleep or shutting it down.
- Accepts one-letter answers for action choice: 's' or 'S' for sleep, 'd' or 'D' for shutdown.
- Validates user inputs and repeatedly prompts until valid input is provided.
- Allows user to specify the delay before the chosen action in minutes.
- Displays the exact time when the device will perform the chosen action.
- Provides a countdown every minute until the action time.
- Allows aborting the planned action by pressing
Ctrl+C
(macOS and Linux only).
- Download the
sleep_timer_macos.zsh
file. - Give execute permissions to the script:
chmod +x sleep_timer_macos.zsh
- Run the script:
./sleep_timer_macos.zsh
- Download the
sleep_timer_linux.sh
file. - Give execute permissions to the script:
chmod +x sleep_timer_linux.sh
- Run the script:
./sleep_timer_linux.sh
- Download the
sleep_timer_windows.ps1
file. - Open PowerShell as an administrator.
- If you have not done so, adjust the PowerShell execution policy to allow the execution of scripts:
Set-ExecutionPolicy RemoteSigned
- Navigate to the directory containing the downloaded script and run it::
./sleep_timer_windows.ps1
After you are done, set the PowerShell execution policy back to its original setting (Set-ExecutionPolicy Restricted
) for security reasons.
- zsh shell for macOS
- bash shell for Linux
- PowerShell for Windows
This project is licensed under the Unlicense License - see the LICENSE.md file for details.