You must readPosted by Magnus Glantz 2015-11-04 12:56:57
Problem: 100000000 servers that are not used in your development or test environmnets.
Solution: Put below script in /etc/cron.daily/. 30 days after installation date, the server will shutdown automatically. You can make this as fancy as you want, but the solution is still fairly simple.
# Date format is 15-01-31
# Calculates number of days between today and installation date
if [ "$(( ($(date --date="$DATEB" +%s) - $(date --date="$DATEA" +%s) )/(60*60*24) ))" -ge 30 ]; then
logger -t auto_decommision "Server has passed it's end date. Halting server."
shutdown -h now
|Choose site to share content on|