#!/bin/bash hosts=$(scontrol show hostnames "$1") logfile=/var/log/power_save.log echo "$(date) Suspend invoked $0 $*" >>$logfile for host in $hosts do sudo ssh -i /root/.ssh/maintenance -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -t maintenance@$host "sudo /sbin/shutdown" done exit 0