What are your most useful shell scripts for Sailfish?
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.
there is also this https://together.jolla.com/question/70745/command-line-equivalents-of-gui-commands/
virgi26 ( 2016-02-26 16:51:41 +0200 )editThese 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;
juiceme ( 2016-02-26 22:38:34 +0200 )editbattery=$(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, 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 ?:
Where is "schturman" is a user name of PC.
Schturman ( 2016-02-27 13:07:36 +0200 )editThanks
@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 +0200 )editOk, thanks ;) For now I do it manually with winSCP...
Schturman ( 2016-02-27 13:36:44 +0200 )edit