I am using the new Ubuntu, where I have Domoticz server and MagicMirror running.
after 15 minutes the PC goes to sleep and then wakes up with PIR (ESP8266).
After waking up, it takes a long time for the domoticz server to start working and sending Information to MagicMirror. I don't want to solve it with service monitor.
I would like to set up a script:
before putting the PC to sleep run "sudo service domoticz.sh stop"
after waking up the PC run "sudo service domoticz.sh start"
it works reliably in the command line, it just needs a password that I enter and it's ok.
I saw somewhere that something like this can be used, but I don't know exactly where to write, save and that it doesn't ask for a password. Would someone be willing to write the exact procedure where to write what and save? I found a lot of versions and maybe I got it wrong or the instructions are for older Ubuntu
First of all thank you very much for the joy and newbie to ubuntu.
Code: Select all
#!/bin/sh
PATH=/sbin:/usr/sbin:/bin:/usr/bin
case "$1" in
pre)
#code execution BEFORE sleeping/hibernating/suspending
;;
post)
#code execution AFTER resuming
;;
esac
exit 0
