Skip to content

Commit

Permalink
Added error redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
wtripp180901 committed Aug 17, 2023
1 parent be00d24 commit 63795d3
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions image/k8s-slurmd-create
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
#!/usr/bin/bash
set -euo pipefail

echo "$(date) Resume invoked $0 $*" >> /var/log/slurm/power_save.log
echo "$(date) Resume invoked $0 $*" &>> /var/log/slurm/power_save.log

echo "Arguments: $* $0 $1" >> /var/log/slurm/power_save.log
echo "Arguments: $* $0 $1" &>> /var/log/slurm/power_save.log

hosts=$(scontrol show hostnames $1) # this is purely a textual expansion, doens't depend on defined nodes
echo "Powering up hosts: $hosts" >> /var/log/slurm/power_save.log
echo "Powering up hosts: $hosts" &>> /var/log/slurm/power_save.log
for host in $hosts
do
echo "Creating $host" >> /var/log/slurm/power_save.log
touch tmpfile.yml
sed s/SLURMD_NODENAME/$host/ /etc/slurm/slurmd-pod-template.yml > tmpfile.yml
echo "sed successful" >> /var/log/slurm/power_save.log
kubectl create -f tmpfile.yml &> /var/log/slurm/power_save.log
echo "done" >> /var/log/slurm/power_save.log
done
echo "Creating $host" &>> /var/log/slurm/power_save.log
( sed s/SLURMD_NODENAME/$host/ /etc/slurm/slurmd-pod-template.yml | kubectl create -f - ) &>> /var/log/slurm/power_save.log
echo "done" &>> /var/log/slurm/power_save.log
done

0 comments on commit 63795d3

Please sign in to comment.