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

What are your most useful shell scripts for Sailfish?

asked 2016-02-26 16:35:31 +0300

ossi1967 gravatar image

This is probably not a typical question people could actually answer - still, as there’s hardly a more suitable forum out there, I’ll put it as a question here:

What are the really smart (or just very useful) things you do on your Jolla phone using nothing but either a shell script or even a single command in a *.desktop-file? Can you share with us your sexy scripts for auto-backup, timed text messages, bulk tagging etc etc etc? In my opinion, being able to simply write a short shell script instead of having to search for full blown "apps" is one of the great things in SailfishOS. I’m certain quite a few of these scripts (and their authors) deserve as much attention and acknowledgement as applications with a full blown GUI.

Why not collect the greatest and most interesting scripts here as answers to this? It'll be fun - but also useful as it shows what the various "How do I do XXX from the command line?"-questions on TJC finally helped people to achieve. It could even be something like a small coding competition, with nothing to win of course but karma from the votes you gather for your scripts.

  • If you already published your shell scripts here on TJC (and I’ve spotted a few) – write an answer to this question and link to your original post.

  • If you wrote a script already but never published it – do it now, also as an answer below (with a short explanation of course).

  • If you never thought of solving a problem with something as seemingly simple as a shell script – start coding now. Anything you think can be useful. 

Readers: You can comment on scripts and suggest improvements. Above all, of course, you should vote to say thanks for the added functionality those scripts provide. Don’t just copypaste them to your device, though, as long as you don’t understand exactly what they do.

edit retag flag offensive close delete



These are pretty useful for me, stuff that I run from cron.

This one checks for new mail. I run it with special schedule, every 10 minutes in working hours during week, every half-an-hour during weekends at daytime when I am awake;

DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/100000/dbus/user_bus_socket" /bin/dbus-send --session --type=method_call --print-reply --dest=com.meego.msyncd /synchronizer com.meego.msyncd.startSync string:'syncemail-3' > /dev/null 2>&1

This one I run nightly to back up my home;

rsync -av /home/nemo/ backupz@toosa.swagman.org:/home/backupz/

This one I run every 30 minutes to log my battery level to file;

battery=$(upower -d | grep percentage | awk '{print $2}') ; date=$(TZ='Europe/Helsinki' date "+%d.%m.%Y %H:%M") ; echo "$date --> $battery" >> /home/nemo/powerlog.txt

juiceme ( 2016-02-26 22:38:34 +0300 )edit

@juiceme, hi. Can you explain please how to copy files by using rsync over ssh to windows, please.
For example I need copy of /home/nemo/* to H:\NOKIA\Jolla on my PC...
It should look something like this ?:

rsync -av /home/nemo/* schturman@\NOKIA\Jolla

Where is "schturman" is a user name of PC.

Schturman ( 2016-02-27 13:07:36 +0300 )edit

@schturman, I am afraid I canot help you very much as it has been more than 10 years since I last touched any windows ;)

If it works aything similar to Linux, then it looks OK to me. You also need to set up public key authenication so you can do tis automatically, without need to type in password. (I don't know if tat is possible in widoze...)

juiceme ( 2016-02-27 13:29:27 +0300 )edit

Ok, thanks ;) For now I do it manually with winSCP...

Schturman ( 2016-02-27 13:36:44 +0300 )edit

2 Answers

Sort by » oldest newest most voted

answered 2016-02-26 17:04:29 +0300

updated 2016-02-26 17:31:29 +0300

This may look like an ad, but I published a set of scripts some time ago :)

Theme Pack Support

It enables switching between different icon, system sound and font packs (I wrote also a wiki to properly package them). Furthermore, you can increase both system and Android font size. An UI will come sometime in the future (tho a 3rd party one is already on OpenRepos), but so far it's as wild as a bash script can be :)


It allows the calendar icon to display the current day.


In a similar fashion, it displays the current time on the clock icon.

They are already packaged and published on OpenRepos, for easy managing and updating.

Hope they can be useful :)

edit flag offensive delete publish link more

answered 2016-02-29 16:21:49 +0300

ossi1967 gravatar image

OK, this is one from the "special interest" section and probably not useful for all that many people. Still, I keep using it. So here it is:

It's a voting script that allows me to vote for my favorites in TV shows that allow the audience to influence the winner by calling or sending texts. My problem is that usually I want to vote for more than only one participant. I'd like to define in advance who gets how many % of my votes. Because I usually know both the phone number and the running order, I use a variantion of this script:


# put phone number for voting (sending texts) here; 

for number in 02 02 03 03 03 03 03 03 03 03 07 07 15 15 15 15 15 15 15 15 
echo "SMS to $phone$number"    
dbus-send --system --dest=org.ofono /ril_0 org.ofono.MessageManager.SendMessage string:$phone$number string:$number     

Of course you'll probably need to adapt the thing depending on how the TV station handles such votings. I still think it's nice idea because it shows shell scripts reach beyond the usual topics. :)

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools



Asked: 2016-02-26 16:35:31 +0300

Seen: 3,581 times

Last updated: Feb 29 '16