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

# Run script on certain time/date

Is there a way to make the OS execute a script on a certain time/date? I know that Sailfish doesn't support cronjobs, but are there any alternative way to establish the same functionality?

edit retag close delete

Very true! This would be awesome. There is quite a similar question that should be cross referenced here: https://together.jolla.com/question/1770/alarm-could-trigger-any-shell-command/

( 2014-04-04 21:48:19 +0300 )edit

Sort by » oldest newest most voted

You might wanna have a closer look to "fcron" from OpenRepos.net. Maybe it will suits your needs.

more

Yes, it seems like a nifty program. However I cannot manage to make it work. When I try fcrontab -e (to edit current users fcrontab) I get:

Could not authenticate user using PAM (7): Authentication failure

Doesn't matter if I run as root or not

( 2014-04-07 23:52:04 +0300 )edit

i have not tried it but sailfish os was changed (in update 1.0.3.8) to introduce a security model. have a look at the file /usr/share/mapplauncherd/privileges

might work if you edit it?

( 2014-04-08 00:55:58 +0300 )edit

I compiled it from source instead, and it works like a charm. Thanks for the tips.

EDIT: seems like fcron misses deadlines if the phone isn't active.

( 2014-04-12 01:09:02 +0300 )edit

If you are using fcron package from openrepos the /etc/pam.d/fcron file is not a pam config file.

create a file /etc/pam.d/fcrontab like this:

auth       sufficient   pam_rootok.so
auth       include      system-auth
account    include      system-auth
session    include      system-auth


and maybe /etc/pam.d/fcron the same.

And you can use fcrontab -e as root.

( 2014-04-22 20:32:50 +0300 )edit

Thanks for this advice, it worked. So far I've only done the first step (creating the fcrontab file). The /etc/pam.d/fcron seems to be the same as /etc/fcron.conf (which I suppose is wrong for PAM). But are you saying that Ican safely replace the contents of this file too with the same content as that of the /etc/pam.d/fcrontab file?

( 2014-04-24 10:59:53 +0300 )edit

Systemd supports this. Not sure from which version and up though and i have no idea which version is included in sailfish.

more

Hmm, I've looked in to systemd and it seems like this could really solve my problem. However, I don't get it to work. Either I've done something wrong or Sailfish doesn't support timers

EDIT: though it seems like someone has done it before: https://www.wolf-kissendorf.de/wordpress/?p=179

( 2014-04-04 19:55:44 +0300 )edit

i don't think systemd on the phone supports this (it is old. only supports monotonic timers). newer version supports calendar timers, which is what you are looking for. this is available from v197 onwards. so we are waiting for jolla to upgrade systemd.

( 2014-04-07 14:00:35 +0300 )edit

Yes, I've seen the first link you posted, but since came over that guide I thought that maybe timers worked anyway. Also, I can see that there are some .timer-files in /usr/lib/systemd/system/ and /lib/systemd/system/

( 2014-04-07 23:04:57 +0300 )edit