Compare commits

...

2 commits

Author SHA1 Message Date
mwiegand
fab4d0a476 wakeup hook 2022-02-12 20:40:28 +01:00
mwiegand
cf6e716301 fix if 2022-02-12 20:40:14 +01:00
3 changed files with 7 additions and 2 deletions

View file

@ -22,7 +22,7 @@ do
done done
LOGINS=$(who -u | grep pts\/ | wc -l) LOGINS=$(who -u | grep pts\/ | wc -l)
if ! [[ "$LOGINS" =~ "^0$" ]] if [[ "$LOGINS" -gt 0 ]]
then then
echo "ABORT: $LOGINS user logins" echo "ABORT: $LOGINS user logins"
exit 0 exit 0

View file

@ -24,7 +24,7 @@ def wake_command(metadata):
return { return {
'wol-sleeper': { 'wol-sleeper': {
'wake_command': f"ssh wol@{waker_hostname} 'wakeonlan {mac} && while ! ping {ip} -c1 -W3; do true; done'", 'wake_command': f"ssh -o StrictHostKeyChecking=no wol@{waker_hostname} 'wakeonlan {mac} && while ! ping {ip} -c1 -W3; do true; done'",
}, },
} }

5
hooks/wake_on_lan.py Normal file
View file

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