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

CLI paused and commands stopped when device locked

asked 2015-07-24 00:02:52 +0200

lakutalo gravatar image

updated 2015-07-24 10:48:52 +0200

It seems that a command run in terminal/fingerterm is paused the moment I lock my device.

I wanted to back up my home dir using tar, but I could only observe progress as long as I was keeping my phone unlocked, doing some alibi browsing, which was quite boring as the backup took about an hour. Looking at it from a different perspective, this sucked quite some battery, too.

How can I make sure that the script or cmd I launched continues after locking my phone?

edit retag flag offensive close delete



Do you connect via wifi or usb?

My experience shows that wifi transmitter on jolla frequently enters sleep mode when jolla's screen is turned off and therefore response to keypresses and and command output becomes laggy.

bte, try to hit enter when you command is freezed. It seems that some input wakes up kernel.

Self-Perfection ( 2015-07-24 01:03:35 +0200 )edit

I use fingerterm, so input is done directly from the device - just updated the request. I would like to fire and forget not having to watch the process. The cmd just takes its time, I reckon on having to wait for several minutes. But shutting off the display would be cosy for the battery. Generally I appreciate that the phone enters sleep mode, but just in this case I would like to keep my cmd from joining the others.

lakutalo ( 2015-07-24 09:18:42 +0200 )edit

Seems fairly odd since for example my device works differently; I frequently execute scripts from cron and they work even when the device is in deep sleep.

Maybe you have some special power saving setting/tweak enabled?

juiceme ( 2015-07-24 13:31:10 +0200 )edit

User input obviously is treated in a different way compared to your method. So maybe the best solution is to build some kind of periodic hook and hinge my command as a script. I thought of using dbus in the first place. But systemctl might be a way for the "hook".

lakutalo ( 2015-07-24 14:18:09 +0200 )edit


Try creating a shortcut (.desktop) for it and start the script from the UI. It seems to be working on my Jolla.

LVPVS out.

LVPVS ( 2015-07-25 22:10:36 +0200 )edit

2 Answers

Sort by » oldest newest most voted

answered 2015-07-24 09:38:24 +0200

t-lo gravatar image

The Jolla phone's low power mode is pretty aggressive, it may even disturb user space filesystems (FUSEs): https://together.jolla.com/question/96381/data-loss-during-io-in-deep-sleep/.

A worthwhile workaround could be to charge the device while your script is running. OTOH it may be worth it messing around with systemctl to figure out what services / units need to be started/stopped in order to disable low power mode - this way your script may prevent the phone from sleeping when there's work to do.

edit flag offensive delete publish link more


Thanks, I will experiment on that and let you know if I was successful.

lakutalo ( 2015-07-24 10:41:02 +0200 )edit

As @t-lo told the easiest way is to simply connect the phone to a charger. Even when battery is full the charging logic will prevent the phone from entering standby.

V10lator ( 2015-07-24 12:14:13 +0200 )edit

answered 2017-12-13 14:05:00 +0200

lakutalo gravatar image

updated 2017-12-13 14:08:07 +0200

Another solution is to use keepalive-tool. It comes with the respective package installed by pkcon install libkeepalive-glib-tools.

This tool prevents your phone from going to deep-sleep while executing a command.

edit flag offensive delete publish link more


SSH keepalive is too complicated?

coderus ( 2017-12-13 14:30:59 +0200 )edit

OP states that the command was entered from fingerterm, i.e. phone UI, not over network. I'd suggest GNU Screen or similar to keep things running in the background.

Mohjive ( 2017-12-13 15:18:37 +0200 )edit

ah, okay then. keepalive-tool should help

coderus ( 2017-12-13 17:43:02 +0200 )edit

@coderus I've tried the SSH keepalive parameter you have suggested (on Dec 13 '17) but it is ignored somehow, please read this for a detailed explanation of what I did.

SebM ( 2019-11-29 20:36:22 +0200 )edit
Login/Signup to Answer

Question tools

1 follower


Asked: 2015-07-24 00:02:52 +0200

Seen: 392 times

Last updated: Dec 13 '17