[bc029c]: / cloudCode / Training / sagemaker_autostop.sh

Download this file

12 lines (7 with data), 409 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#!/bin/bash
set -e
IDLE_TIME=2000
echo "Fetching the autostop script"
wget https://raw.githubusercontent.com/aws-samples/amazon-sagemaker-notebook-instance-lifecycle-config-samples/master/scripts/auto-stop-idle/autostop.py
echo "Starting the SageMaker autostop script in cron"
(crontab -l 2>/dev/null; echo "*/5 * * * * /usr/bin/python $PWD/autostop.py --time $IDLE_TIME --ignore-connections") | crontab