bundles/octoprint: add systemd-wrapper script
All checks were successful
bundlewrap/pipeline/head This commit looks good
All checks were successful
bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
7ea85247e0
commit
d02538368a
3 changed files with 26 additions and 0 deletions
22
bundles/octoprint/files/systemd-wrapper
Normal file
22
bundles/octoprint/files/systemd-wrapper
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
systemctl=$(command -v systemctl)
|
||||||
|
|
||||||
|
if [[ -z "$systemctl" ]]; then
|
||||||
|
echo "systemctl not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$1" == "restart-octoprint" ]]; then
|
||||||
|
$systemctl restart octoprint
|
||||||
|
|
||||||
|
elif [[ "$1" == "restart-system" ]]; then
|
||||||
|
$systemctl reboot
|
||||||
|
|
||||||
|
elif [[ "$1" == "shutdown-system" ]]; then
|
||||||
|
$systemctl poweroff
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "unknown command"
|
||||||
|
exit 1
|
||||||
|
fi
|
|
@ -32,4 +32,7 @@ files = {
|
||||||
'svc_systemd:octoprint:restart',
|
'svc_systemd:octoprint:restart',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'/opt/octoprint/systemd-wrapper': {
|
||||||
|
'mode': '0755',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ defaults = {
|
||||||
'home': '/opt/octoprint',
|
'home': '/opt/octoprint',
|
||||||
'sudo_commands': {
|
'sudo_commands': {
|
||||||
'/usr/bin/vcgencmd',
|
'/usr/bin/vcgencmd',
|
||||||
|
'/opt/octoprint/systemd-wrapper',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue