Sailcron

Rating: 
5
Your rating: None Average: 5 (15 votes)

Warning regarding SailfishOS upgrades:

to prevent any misbehavior of the cron daemon, please stop the daemon before starting any OS upgrade

 

Frontend for the cron scheduler. Makes it easy to view your schedules in a more friendly way.

Also gives the opportunity to fully manage crontabs of nemo and root. The usual warning: always be careful with root permissions. Disabling is achieved by adding a specific comment string in the cron entry.

Displayed commands can be replaced by a more meaningful text.

Using cron-descriptor for the conversion of cron expressions into human readable strings.

Using python-crontab for the cron timestring syntax check.

Needs vixie-cron or cronie as cron daemon, which can be found in my repo.

Loading a large crontab can cause some unresponsiveness.

If you want to play more with the crontab syntax, you can have a try here: http://www.corntab.com/pages/crontab-gui

Why use cron as a scheduler?

  • Stable, simple and well known
  • Low on resources and a wakelock only every minute does not really effect battery usage
  • Systemd timers are not accurate, because they are effected by sleep states
  • Timed-qt5 (the "native" scheduling) would have been another option. I worked with something similar on Maemo, which I liked, but was missing documentation and implemented features

 

Swedish translation: eson

Sources can be found on github

 

Screenshots: 

Keywords:

Application versions: 
AttachmentSizeDate
File harbour-sailcron-0.4-2.armv7hl.rpm162.14 KB25/04/2020 - 01:24
File harbour-sailcron-0.4-2.i486.rpm164.37 KB25/04/2020 - 01:24
File harbour-sailcron-0.4-3.armv7hl.rpm162.04 KB29/09/2020 - 23:15
File harbour-sailcron-0.4-3.i486.rpm164.88 KB29/09/2020 - 23:15
File harbour-sailcron-0.4-4.armv7hl.rpm161.62 KB19/10/2020 - 18:07
File harbour-sailcron-0.4-4.i486.rpm164.45 KB19/10/2020 - 18:07
File harbour-sailcron-0.4-5.armv7hl.rpm137.81 KB05/02/2021 - 01:45
File harbour-sailcron-0.4-5.i486.rpm140.7 KB05/02/2021 - 01:45
File harbour-sailcron-0.4-5.aarch64.rpm139.48 KB15/05/2021 - 01:19
File harbour-sailcron-0.5-1.i486.rpm141.11 KB14/11/2021 - 12:15
File harbour-sailcron-0.5-1.aarch64.rpm139.34 KB14/11/2021 - 12:15
File harbour-sailcron-0.5-1.armv7hl.rpm137.75 KB14/11/2021 - 12:15
File harbour-sailcron-0.6-1.aarch64.rpm135 KB04/06/2022 - 13:04
File harbour-sailcron-0.6-1.i486.rpm136.43 KB04/06/2022 - 13:04
File harbour-sailcron-0.6-1.armv7hl.rpm133.33 KB04/06/2022 - 13:04
File harbour-sailcron-0.7-1.aarch64.rpm135.29 KB06/06/2022 - 15:57
File harbour-sailcron-0.7-1.i486.rpm136.75 KB06/06/2022 - 15:57
File harbour-sailcron-0.7-1.armv7hl.rpm133.66 KB06/06/2022 - 15:57
Changelog: 
  • 0.7-1 Special cron entries now translatable
  • 0.6-1
    • Do not notify cronline is ok at save
    • Added midnight and anually as special cron entries
  • 0.5-1
    • Opt out of sailjail
    • Switch from popup messages to smaller banner
  • 0.4-5 Changes in detecting running cron because Jolla installed yet more crippling busybox tooling in favor of gnu packages in SFOS 4.0.
  • 0.4-4 Do not assume nemo to be the default user
  • 0.4-3 Fix for SFOS 3.4
  • 0.4-2
    • Yet another fix for SFOS 3.3.0: writing failed as Jolla moved to busybox base64 command
  • 0.4-1
    • Fix for SFOS 3.3.0 so custom descriptions are displayed again
    • Small change in notification
  • 0.3-1
    • Load custom texts async for faster loading
    • Minor layout changes
  • 0.2-1
    • updated python-crontab and cron-descriptor
    • No longer require vixie-cron as a dependency
  • 0.1-21
    • Added button to cleanup orphaned custom texts
    • Upgraded python-crontab to 2.3.7
    • Latest changes from cron-descriptor
  • 0.1-20
    • Now support @reboot,@weekly etc.
    • Updated python-crontab and cron descriptor to latest version
  • 0.1-18
    • Cron descriptor updated to 1.2.9
    • Python-crontab updated to 2.2.3
  • 0.1-17
    • Increased max length cron line
    • Cron descriptor updated to 1.2.8
    • Python-crontab updated to 2.2.1
  • 0.1-16 Implemented python call_sync workaround (credits otsaloma) due to bug in 2.1.0.x
  • 0.1-15 Updated swedish translation
  • 0.1-14
    • Edit menu selectable directly from detailspage
    • Synced python-crontab to upstream 2.1.1
    • Cron syntax checker will now fail if cron range is backwards
  • 0.1-13 Settingspage no longer a dialog page (with cancel/accept)
  • 0.1-12 fixed introduced bug that would insert invalid cron entry
  • 0.1-11
    • The input "*/number" was not correctly passed
    • Limit accepted input characters
    • Added new python module for actual cron string checking
  • 0.1-10
    • Increased max length of input fields
    • Included upstream fix for cron-descriptor
  • 0.1-9
    • Updated Swedish
    • Added Dutch language
  • 0.1-8
    • No auto capitalisation in command field
    • Create custom names for execution string
  • 0.1-7 Fixed not showing cron entries with '=' sign
  • 0.1-6 Fixed weekday numbers explanation
  • 0.1-5 Fix: pipe symbol was not handled correctly
  • 0.1-4
    • Included cron-descriptor upstream change for week/month localizations
    • Swedish translation updated
  • 0.1-3
    • Fix: ignoring settings in crontab led to corruption
    • Manage crontab daemon from settings page
  • 0.1-2 Fix: try to ignore settings done in crontab
  • 0.1-1
    • Added Swedish translation
    • Localized days of week in cron-descriptor part
  • 0.1-0 Initial version

Comments

aerique's picture

Hi, I had two issues to get this working on a fresh 3.4.0.24 install on an F(x)tec Pro1:
- `cron.allow` only contained `nemo` and not `defaultuser`
- `crontab -e` was looking for `/usr/bin/vi`, which for me was in `/bin`

ade's picture

Thank for your feedback. Both issue are not Sailcron related. That gives me the impression the defaultuser changes in Sailcron itself where sufficient (as I could not test it myself).
When you are talking about cron.allow it must be Cronie that you are using. And you are correct, defaultuser is not added to that list yet. I will upload an updated version.
As for the "crontab -e" command: I do not think that is cron related, but depending on EDITOR settings. Mine is vim, which is located in /usr/bin.

aerique's picture

Yes, you're right. I did not think this through (it was late ;-)) and it is indeed Cronie that I am running.

As for `$EDITOR`, I do not have it set and I also have Vim installed.  Anyway, if I'm the only one to report this then the fault is probably on my side.

ade's picture

There is your problem:

export EDITOR=vim

and crontab -e will work.

aerique's picture

I realize that :-)

What I meant to say is that on a freshly installed phone it will not work for people.  But the ones who can't figure it out probably would not install cron ;-)

ade's picture

That is very likely. But in theory, you don't need to use crontab -e when you use Sailcron :-)

aerique's picture

I was moving settings from another phone :-)

wickedsp1d3r's picture

If I would like to uninstall it, which all traces do I need to delete? Thanks.

ade's picture

Just the related folder in .config, as is the case with most Sailfish apps.

carmenfdezb's picture

Does it work on SailfishOS X? I'm trying to run a script as nemo user using sailcron, but it doesn't work for me: it doesn't do anything. If I run script manually from Terminal, it works fine.

ade's picture

Sounds like a cron issue, not typically a sailcron issue.
How does the generated crontab line look? ("crontab -l" and find the entry)
And what does the script execute? It might be missing some environment settings you have at your disposal when running from the terminal.

Another way to debug it would be to add "> /tmp/mycronoutput.txt 2>&1" to the crontab line and see if gets created and what the content of the file is afterwards.

carmenfdezb's picture

Thank you for your answer! I've been trying with this simple command:
echo "This is a test" > /home/nemo/tmp/test.log
but it doesn't do anything. This entry is showed if I run crontab -l from Terminal.

ade's picture
crontab -l

should give a scheduling moment like

59 17 * * * your_command

Is there no scheduling in the this cron line? If there is not, the crontab entry is invalid.
I assume cron is running (else sailcron would complain). Is there any error when you start sailcron via the terminal and add a new entry?

carmenfdezb's picture

nemo ~ $ crontab -l
*/5 * * * * echo "This is a test" > /home/nemo/tmp/te
st.log

If I start sailcron from Terminal I don't get any error:
nemo ~ $ harbour-sailcron
[D] unknown:0 - Using Wayland-EGL
[D] unknown:0 - Got library name: "/usr/lib/qt5/qml/
io/thp/pyotherside/libpyothersideplugin.so"
[D] :156 - pretty_cron module is now imported
[D] :164 - read_alias module is now imported
[D] onStatusChanged:23 - status changed

Cron service is activated and running:
nemo ~ $ systemctl status cron
● cron.service - Cronie Cron Daemon
Loaded: loaded (/lib/systemd/system/cron.service;
enabled; vendor preset: enabled)
Active: active (running) since lun 2020-08-10 21:3
7:06 CEST; 10h ago
Main PID: 24341 (cron)
CGroup: /system.slice/cron.service
└─24341 /usr/sbin/cron -s -n

ade's picture

For the record, "59 17 * * *" means run this only at 17:59 every day. If you want a (test) run every minute it should be "* * * * *".
The /home/nemo/tmp/ directory does exist? Is there log data in /var/cron/log?

carmenfdezb's picture

I've changed it to run every minute and it doesn't do anything:
nemo ~ $ crontab -l
* * * * * echo "This is a test" > /home/nemo/tmp/test
.log

/home/nemo/tmp/ directory exists, but /var/cron/ doesn't exist.

I'm using cronie, that I've installed from storeman

carmenfdezb's picture

Ok cronie use /var/spool/cron path, but I don't have any log file there

ade's picture

I thought you where using Vixie cron, but it's cronie. Good choice, as this cron is still maintained. Cronie does not have its own logfile indeed. You could try to see if this gives any clue: "journalctl -u cron" (as root).

If this gives no output, maybe give Vixie cron a chance?

carmenfdezb's picture

I've tried vixie cron and it works!!! The next step is to know why my script doesn't work, maybe environment setting is the reason.
Thank you for your help!!

carmenfdezb's picture

Finally, I've solved my problem by adding PATH parameter to my script:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

ade's picture

Nice to hear you solved your problem.

You can also add that PATH entry at the start of your crontab, so it is available for all your cron jobs.

My first 3 entries are:

MAILTO=""
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

By default cron wants to mail errors, which is of no use on sailfish. Setting MAILTO empty wil disable this (and could spare a few cpu cycles).

carmenfdezb's picture

nemo ~ $ sudo journalctl -u cron
-- No entries --

dexic's picture

I have downloaded it manually from OpenRepos.net now.

Still doesn't work. :-(

ade's picture

There was indeed something really weird going on with openrepos which made the latest version not available. I re-uploaded the rpm's once again and now they are visible as update.

ade's picture

Then I need the terminal logs I was talking about earlier. Without them, I can't tell what is going on on your phone.

dexic's picture

I wish that I could send a screenshot of Storeman.

dexic's picture

Your changelog shows 0.4-2. Storeman offers me 0.3-1. With pkcon refresh there is nothing happening.

dexic's picture

Hello! For me it doesn't save any new entries. Xperia 10 on 3.3.0.14. Update not available. Storeman offers 0.3-1.
crontab -e gives output:
no crontab for nemo - using an empty one
/bin/sh: /usr/bin/vi: No such file or directory
crontab: "/usr/bin/vi" exited with status 127

ade's picture

But wait, you have Sailcron 0.3-1 installed??? That's not compatible with SailfisOS 3.3. You really need 0.4-2. Try a manual "pkcon refresh" or something.

ade's picture

Just tested myself, no problems here.

I suppose you have /usr/bin/vi as EDITOR env setting, but no vi installed?

Will have to investigate if that can interfer with sailcron. Maybe starting harbour-sailcron in the terminal will give extra info when you try to add an entry?

Pages