Help Center> ModelArts> Model Development> Performing a Training> Cloud Shell> Preventing Cloud Shell Session from Disconnection
Updated on 2024-05-07 GMT+08:00

Preventing Cloud Shell Session from Disconnection

To run a job for a long time, you can use the screen command to prevent the job from failing due to disconnection.

  1. If screen is not installed in the image, run apt-get install screen to install it.
  2. Create a screen terminal.
    # Use -S to create a screen terminal named name.
    screen -S name
  3. View the created screen terminals.
    screen -ls  
    There are screens on: 
    2433.pts-3.linux    (2013-10-20 16:48:59) (Detached)
    2428.pts-3.linux    (2013-10-20 16:48:05) (Detached)
    2284.pts-3.linux    (2013-10-20 16:14:55) (Detached)
    2276.pts-3.linux    (2013-10-20 16:13:18) (Detached)
    4 Sockets in /var/run/screen/S-root.  
  4. Connect to the screen terminal whose screen_id is 2276.
    screen -r 2276
  5. Press Ctrl+A+D to exit the screen terminal. After the exit, the screen session is still active and can be reconnected at any time.

For details about how to use screens, see Screen User's Manual.