I am looking for the way to launch a script at boot.
I knew how to do that on a linux machine (link in /etc/rc5/ etc) but I fail on finding how to do it in Salilfish. I am not very used to systemd either, I have to say.
I followed the advices in this post but I guess some things have changed since it was written.
Thanks
Previous Linux systems used init scripts from /etc/init.d for decades. Unfortunately this has been mainly replaced by systemd which collects complex syntax from complex directory structure. You may have a look at /etc/systemd/<system|user>/ for some of those scripts.
You may spot some indication of my attitude towards systemd.
I’m not surprised that notoriously evil companies run it. The distributions of medium- and small-impact sometimes have me wonder … but they’re probably happy with a comparably tiny bribe for selling out their users.
But yes, except for mobile it’s rather easy to avoid.
Yes, thank you. I didn’t dare to just copy. I was not sure systemctl (that I never had patience to learn) was working like on a PC.
And SFos root structure and system in general is still a bit obscure to me…
Anyways, it is now working and this is cool. :–)
I just changed this in /etc/systemd/system/myService.service:
Instead of:
Also for information, @attahmentioned systemd timers.
I find interresting not to add more applications if there is already something in the system allowing to start a script at boot.
This might be lighter but less comfortable/easy though.
Do you need anything in addition to what you mention?
On XA2 this gives:
$ systemctl --user enable autostart-apps
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
instance name specified.
Is definitely the way to go if your script doesn’t do anything that requires more rights than user. I should have mentioned that when I posted initially. I was in sysadmin needs root mode. Bad habit.
Would you anyone know, which of these targets should I use when I want to execute my script after the SD card was mounted?
(I want to automate what I currently do manually: bind mount a directory from SD card into the android_storage. I couldn’t manage to give Android app F-Stop write permissions on the SD card…)
# systemctl list-units --type target
UNIT LOAD ACTIVE SUB DESCRIPTION
basic.target loaded active active Basic System
bluetooth.target loaded active active Bluetooth
cryptsetup.target loaded active active Local Encrypted Volumes
getty.target loaded active active Login Prompts
graphical.target loaded active active Graphical Interface
local-fs-pre.target loaded active active Local File Systems (Pre)
local-fs.target loaded active active Local File Systems
multi-user.target loaded active active Multi-User System
network-online.target loaded active active Network is Online
network.target loaded active active Network
paths.target loaded active active Paths
remote-cryptsetup.target loaded active active Remote Encrypted Volumes
slices.target loaded active active Slices
sockets.target loaded active active Sockets
sound.target loaded active active Sound Card
swap.target loaded active active Swap
sysinit.target loaded active active System Initialization
timers.target loaded active active Timers