You are not logged in.

#1 2017-10-21 13:25:17

Cbhihe
Member
Registered: 2017-04-09
Posts: 219

[SOLVED] start up an app as service in /etc/systemd/system

[4.13.7-1-ARCH with Gnome on Xorg]

I want to launch '/usr/bin/selektor' at startup after I get network connectivity either thru WiFi or cable Ethernet.I could easily use gnome-tweak-tool to launch Selektor upon login but I prefer to do so for all users after network connectivity is achieved. So I thought going the "service launch" way was  more appropriate (do correct me if that is a dead end.)

I did look at the systemd wiki on services and units at the Autostarting wiki, as well as at this Arch forum post, but I am left with 2 questions:

$ cat /etc/systemd/system/multi-user.target.wants/selektor-launch.service 
[Unit]
Description=launch Selektor at boot

[Service]
ExecStart=/usr/bin/selektor

[Install]
WantedBy=multi-user.target
$ sudo systemctl enable selektor-launch.service
Failed to enable unit: Unit file selektor-launch.service does not exist. 

1/ The enable instruction above yields an error I don't grok.
2) What is the specific instruction I should include as a dependency for networking.
I thought about After= network.target, placed after the unit description above, but I am not sure this is the favored/best/preferable (don't blast me on the term!)  way of doing it.

Cheers.
-ced

Last edited by Cbhihe (2017-10-21 16:53:37)


I like strawberries, therefore I'm not a bot.

Offline

#2 2017-10-21 13:52:26

iswrong
Member
Registered: 2017-10-21
Posts: 1

Re: [SOLVED] start up an app as service in /etc/systemd/system

Cbhihe wrote:

1/ The enable instruction above yields an error I don't grok.

Admin-provided scripts should be put in /etc/systemd/system. Running systemctl enable <yourunit> will symlink the unit in the relevant target directory for you.

2) What is the specific instruction I should include as a dependency for networking.

Adding

After=network.target

in the unit section should do the trick.

Offline

#3 2017-10-21 16:48:45

Cbhihe
Member
Registered: 2017-04-09
Posts: 219

Re: [SOLVED] start up an app as service in /etc/systemd/system

Swell, @iswrong. Thank you.


I like strawberries, therefore I'm not a bot.

Offline

#4 2017-10-21 16:56:18

loqs
Member
Registered: 2014-03-06
Posts: 17,196

Re: [SOLVED] start up an app as service in /etc/systemd/system

Is selektor not GUI based?

Offline

#5 2017-10-21 18:31:12

Cbhihe
Member
Registered: 2017-04-09
Posts: 219

Re: [SOLVED] start up an app as service in /etc/systemd/system

yes, it is and that induces a number of problem when starting it before gdm comes up. But I am trying things out... and might just have it launch at gdm login in the end. Sigh... 
The reason I was trying to do launch Selektor early was it needs about 7 to 10s to load currently available Tor nodes and geolocations. ... sigh.
But waiting seems to be of essence in this case. I don't quite see a way of shaving off seconds.


I like strawberries, therefore I'm not a bot.

Offline

Board footer

Powered by FluxBB