Compare commits

..

No commits in common. "b08fe2c749a992ed535a3b610cf1caf7e0493735" and "dbca66326a0d3bec33b3ee335e2b41017912e3cf" have entirely different histories.

2 changed files with 5 additions and 5 deletions

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
UPTIME=$(cat /proc/uptime | cut -d. -f1) UPTIME=$(cat /proc/uptime | cut -d. -f1)
MIN_UPTIME=$(expr 60 \* 20) MIN_UPTIME=$(expr 60 \* 10)
if [[ "$UPTIME" -lt "$MIN_UPTIME" ]] if [[ "$UPTIME" -lt "$MIN_UPTIME" ]]
then then
echo "ABORT: uptime ($UPTIME) lower than min ($MIN_UPTIME)" echo "ABORT: uptime ($UPTIME) lower than min ($MIN_UPTIME)"
@ -21,7 +21,7 @@ do
fi fi
done done
LOGINS=$(netstat -tnpa | grep 'ESTABLISHED.*sshd' | wc -l) LOGINS=$(who -u | grep pts\/ | wc -l)
if [[ "$LOGINS" -gt 0 ]] if [[ "$LOGINS" -gt 0 ]]
then then
echo "ABORT: $LOGINS user logins" echo "ABORT: $LOGINS user logins"
@ -31,7 +31,9 @@ fi
if [[ "$1" = now ]] if [[ "$1" = now ]]
then then
echo "SESPENDING" echo "SESPENDING"
sleep 10
systemctl suspend systemctl suspend
else else
echo "WOULD SESPEND" echo "WOULD SESPEND"
sleep 300
fi fi

View file

@ -2,6 +2,4 @@ from bundlewrap.operations import run_local
def node_apply_start(repo, node, interactive=False, **kwargs): def node_apply_start(repo, node, interactive=False, **kwargs):
if node.has_bundle('wol-sleeper'): if node.has_bundle('wol-sleeper'):
repo\ repo.get_node(node.metadata.get('wol-sleeper/waker')).run(node.metadata.get('wol-sleeper/wake_command'))
.get_node(node.metadata.get('wol-sleeper/waker'))\
.run(node.metadata.get('wol-sleeper/wake_command'))