I am trying to write a script run at resume from suspend to RAM. I know a bit about scripting as I have other .sh, but that type of scripting I am having a hard time understand and my script does not do all I ask for.
My script is located in
and is called
Owned and run by Root. It is Executable.
Basically it's to kill 'fancontrol' and 'cairo-dock' at resume state and restart them. Why I need to kill both? Different reasons, they have bugs I have logged and I try to find an automatic workaround in the meantime. Ask me for more details if you want.
My script had various versions. Here's the latest:
case "$1" in
sudo -u frank nohup cairo-dock -o > /dev/null 2>&1 &
#nohup fancontrol > /dev/null 2>&1 &
#cairo-dock -o > /dev/null 2>&1 &
As you can see I also tried with the commented lines as uncommented.
The actual behavior is that both 'fancontrol' and 'cairo-dock' do get killed. But none are restarting. I can't find why and don't know where to troubleshoot.
Fancontrol needs to be run as root and cairo-dock as user (frank).
I read this to understand more http://sial.org/howto/shell/background/
Apparently I need to dissociate 'fancontrol' from the terminal, cuz it's a deamon.
So I tried the following script:
case "$1" in
cd / || exit 1
sudo -H -u frank -- \
cairo-dock -o <&- \
>> 2>&1 &
It does not work either. I do not understand completely what they explain on that website and I don't know how to adapt it correctly to my script.
It's very easy to start cairo-dock from terminal (fancontrol as well). If I type myself as user the 'nohup' lines it will start fancontrol and get out of terminal and will start cairo-dock and get out of terminal.
So why it's not even starting when that script run? I can't figure out where I am messing up.
Can anyone help me understand my problem so I can find what's wrong?
tnx a lot!