#!/bin/bash HOST=`echo $HOSTNAME | sed -e 's/\(.*\)/\L\1/'` CURRENTDATE=`date +"%Y-%m-%d %T" | sed 's/[[:space:]]//g' | sed 's/:/-/g'` FILE="$HOST-$CURRENTDATE" touch /home/ec2-user/rebooting-$FILE aws s3 cp /home/ec2-user/rebooting-$FILE s3://s3-path/reboot/ FILEEXIST=$(aws s3 ls s3://s3-path/reboot/rebooting-$FILE) if [ -z "$FILEEXIST" ]; then touch /home/ec2-user/rebooting-$FILE aws s3 cp /home/ec2-user/rebooting-$FILE s3://s3-path/reboot/ else rm -f /home/ec2-user/rebooting-$FILE fi /sbin/shutdown -r +$1 exit 0
Comments
0 B
|👍
/👎