world - Add missing sample file for aws imaging script
[dragonfly.git] / share / examples / aws / cleanforamsimaging
1 #!/bin/csh
2 #
3 #
4
5 echo "Clean for AMD copyimage.  This script will destroy ssh keys and"
6 echo "logs, touch /firstboot, and generally make a base AMI image that"
7 echo "has not been messed with a whole lot ready for an aws ec2 create-image"
8 echo "operation."
9 echo ""
10 echo "Use:"
11 echo '    aws ec2 create-image \\'
12 echo '        --name YourAMINameHere \\'
13 echo '        --description "Your AMI Description Here" \\'
14 echo '        --instance-id i-ThisInstanceId \\'
15 echo ""
16
17 if ( "$argv" != "doit" ) then
18     echo "Execute script with 'doit' to really do it"
19     exit 1
20 endif
21
22 echo "Starting cleanup"
23 sleep 1
24 rm -f ~root/.ssh/{authorized_keys,known_hosts} ~root/.history
25 rm -f /home/ec2-user/.ssh/{authorized_keys,known_hosts}
26 rm -f /home/ec2-user/.history
27 touch /firstboot
28 killall syslogd
29 sleep 0.1
30 find /var/log -type f -delete
31 touch /var/log/{auth.log,cron,daemon,maillog,messages,security,userlog}
32 touch /var/log/{wtmp,wtmpx}
33
34 echo "Cleanup complete"