We have moved to a new Sailfish OS Forum. Please start new discussions there.
0

prevent process suspension [answered]

asked 2020-01-04 12:46:48 +0300

eightfourty gravatar image

Need to run a python script every 10min via terminal, however the phone suspends it after a while. Are there any commandline args that will prevent this?

I need it to run overnight as it will trigger an alarm if one of several nearby fires is too close to us. The workaround is to use a night-time clock app at the same time but its not 100% reliable.

edit retag flag offensive reopen delete

The question has been closed for the following reason "the question is answered, an answer was accepted" by pawel
close date 2020-01-06 21:17:15.223245

2 Answers

Sort by » oldest newest most voted
1

answered 2020-01-04 13:26:59 +0300

attah gravatar image

Maybe make it a systemd timer instead of fighting the suspend?

https://together.jolla.com/question/16434/cronjob-on-sailfish/

edit flag offensive delete publish link more

Comments

Looks promising but couldn't get it to work:

timedclient-qt5 -a'whenDue;runCommand=python3 /home/nemo/Downloads/redzone.py' -e'APPLICATION=test;TITLE=test;ticker=10'

My guess is it requires extra formatting of the command, or needs to run via installed qt app?

eightfourty ( 2020-01-05 06:02:35 +0300 )edit
1

answered 2020-01-04 15:56:41 +0300

spiiroin gravatar image

Assuming you are atm interested in easy options rather than optimizing pm behavior, executing

mcetool --set-suspend-policy=early

-> Allows phone to power off display and touch, but cpu is kept alive -> a polling script should work without extra effort, but battery consumption increases significantly.

mcetool --set-suspend-policy=disable_on_charger

-> Disables suspending altogether, but only while phone is connected to charger. An attempt is also made to keep touch panel powered on (and hence display too to some extent) - which might cause touch issues on some device types.

Note that even if systemd timers / timed alarms are successfully used for waking up the device to trigger the script, the device might still suspend during script execution. This can be worked around by wrapping the script exec with keepalive-tool e.g. while something like "sleep 120" could end up getting suspended, "keepalive-tool sleep 120" ought not.

edit flag offensive delete publish link more

Comments

disable_on_charger seems to be working, thanks!

eightfourty ( 2020-01-05 09:29:56 +0300 )edit

Question tools

Follow
3 followers

Stats

Asked: 2020-01-04 12:46:48 +0300

Seen: 178 times

Last updated: Jan 04 '20