tursa-energy-efficiency/2-racks/size-loc32/remote-sudo.sh

15 lines
313 B
Bash
Raw Normal View History

2022-09-07 17:31:28 +01:00
#!/usr/bin/env bash
# shellcheck disable=SC2029
set -euo pipefail
if (( $# != 2 )); then
echo "usage: $(basename "$0") <hostname> <command>" 1>&2
exit 1
fi
host=$1
command=$2
pass='xxxxxxxxxxx' # redacted
sshpass -f ${pass} ssh -oStrictHostKeyChecking=no "${host}" "sudo -S -p '' ${command} < ${pass}"