Auto-shutdown on Linux will only detect connections established via our streaming desktop and web-based terminal. Terminal sessions SSH connections will not be detected. We've written the following script to set your Linux machine to auto-shutdown during periods of inactivity/idle time.
Ubuntu 16.04 & 18.04:
Auto-shutdown on Linux will only detect connections established via our streaming desktop and web-based terminal. SSH connections will not be detected. Use the following script to set your Linux machine to auto-shutdown during periods of inactivity:
The script can be download from here.
- Open a terminal.
- Change directory to root (
cd /
) - Execute
sudo tar xzf /home/paperspace/idle_shutdown.tgz
(substitute with the correct path to the downloaded tarball)
For Linux desktop there is one more step:
Download and install the xprintidle
utility:
sudo apt-get install xprintidle
Afterwards add the desired number of hours that the system can be idle before being shut down by modifying etc/default/idle_shutdown
Examples:
Shutdown after one hour:
IDLE_TIME=1
Shutdown after one week:
IDLE_TIME=168
- Enable the service with:
systemctl enable idle_shutdown.service
- Start it:
systemctl start idle_shutdown.service
The Auto-Shutdown script will now automatically start on boot. If you don't want to shutdown on idle anymore, just edit the file in/etc/default
and leave it blank or disable it via systemd:
sudo systemctl disable idle_shutdown.service
sudo systemctl stop idle_shutdown.service
Any changes will require a restart of the service: systemctl restart idle_shutdown.service
Note: Auto-Shutdown works by detecting changes to the desktop or terminal. If you're simply connected to the terminal or desktop and there are no inputs detected, the machine will assume it is idle.