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

Run script on certain time/date

asked 2014-04-04 18:36:29 +0300

Xiph gravatar image

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 flag offensive 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/

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

2 Answers

Sort by » oldest newest most voted

answered 2014-04-07 10:05:35 +0300

fblm gravatar image

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

edit flag offensive delete publish link 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

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

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

might work if you edit it?

droll ( 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.

Xiph ( 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
password   include      system-auth
session    include      system-auth

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

And you can use fcrontab -e as root.

jolladiho ( 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?

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

answered 2014-04-04 18:42:34 +0300

ApB gravatar image

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

edit flag offensive delete publish link 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

Xiph ( 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.

look here https://together.jolla.com/question/16434/cronjob-on-sailfish/ and https://together.jolla.com/question/15563/add-more-systemd-components/

droll ( 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/

Xiph ( 2014-04-07 23:04:57 +0300 )edit
Login/Signup to Answer

Question tools



Asked: 2014-04-04 18:36:29 +0300

Seen: 467 times

Last updated: Apr 07 '14