Compare commits
2 commits
dbca66326a
...
b08fe2c749
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b08fe2c749 | ||
![]() |
a581dbfee9 |
2 changed files with 5 additions and 5 deletions
|
@ -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 \* 10)
|
MIN_UPTIME=$(expr 60 \* 20)
|
||||||
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=$(who -u | grep pts\/ | wc -l)
|
LOGINS=$(netstat -tnpa | grep 'ESTABLISHED.*sshd' | wc -l)
|
||||||
if [[ "$LOGINS" -gt 0 ]]
|
if [[ "$LOGINS" -gt 0 ]]
|
||||||
then
|
then
|
||||||
echo "ABORT: $LOGINS user logins"
|
echo "ABORT: $LOGINS user logins"
|
||||||
|
@ -31,9 +31,7 @@ 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
|
||||||
|
|
|
@ -2,4 +2,6 @@ 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.get_node(node.metadata.get('wol-sleeper/waker')).run(node.metadata.get('wol-sleeper/wake_command'))
|
repo\
|
||||||
|
.get_node(node.metadata.get('wol-sleeper/waker'))\
|
||||||
|
.run(node.metadata.get('wol-sleeper/wake_command'))
|
||||||
|
|
Loading…
Reference in a new issue