bergware / dynamix

51 stars 38 forks source link

System gets shutdown after sleep wake-up if using custom after wake-up code #59

Open Falcosc opened 2 years ago

Falcosc commented 2 years ago

I guess this line is the problem https://github.com/bergware/dynamix/blob/4d6d339a6cd246346ef676e00ddfa2d2f597ce58/source/s3-sleep/scripts/s3_sleep#L359

If you have a post wake up script which exits with 1 instead of 0 the condition is false, and it will execute system_down.

My last line of the post sleep script which is causing this issue uses the "Test" function, and this will set the exit code to 1.

test "$(date +%s -d "60 days ago")" -gt "$(mdcmd status | sed -n 's/sbSynced=//p')" && /usr/local/sbin/mdcmd check NOCORRECT &> /dev/null

This executes the parity check if it was older than 60 days because crone schedule does not work if the system does sleep.