Description of image

How to Prevent Auto-Shutdown With SSH Connections on Linux Machines

Machines are high-performing computing for scaling AI applications.


Use the Auto-Shutdown feature to prevent idle runtime. Auto-Shutdown on Linux machines can not detect activity when using an SSH connection. Please use the script below if you’d like to prevent auto-shutdown on your Linux Ubuntu machine while connecting via SSH.

Setup

Download the script.

  • 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)

If you’re accessing from a Linux Desktop VM, please complete this step:

Download and install the xprintidleutility:

sudo apt-get install xprintidle

You modify the IDLE time of the machine by accessing the configuration file sudo nano 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 automatically starts on boot. If you don’t want to shut down, 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 require a restart of the service: systemctl restart idle_shutdown.service

Auto-Shutdown works by detecting changes to the desktop or terminal. If you’re connected to the terminal or desktop, and there are no inputs detected, the machine assumes it is idle.