--- a +++ b/cloudCode/Training/sagemaker_autostop.sh @@ -0,0 +1,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