[SOLVED] systemd autostart script

If none of the more specific forums is the right place to ask

[SOLVED] systemd autostart script

Postby sickpig » 2019-01-23 10:41

Hi

trying to autostart applications via systemd service as my WM does not have any autostart section in it

created service in /home/a/.config/systemd/user

my script:

[Unit]
Description=to autostart stuff desktop independant

[Service]
Type=simple
Environment=DISPLAY=:0
Environment="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
ExecStart=/usr/bin/starty

[Install]
WantedBy=default.target

upon running journalctl --user-unit starty.service i get below

- Logs begin at Wed 2019-01-23 22:16:57 AEDT, end at Wed 2019-01-23 22:18:41 AE
Jan 23 22:17:26 a systemd[1323]: Started to autostart stuff desktop independant.

But my applications are not autostarting

appreciate help

thank you
Last edited by sickpig on 2019-01-23 19:56, edited 1 time in total.
haven = Sir P.G. Wodehouse's books. U havent lived unless u have read one :)
User avatar
sickpig
 
Posts: 314
Joined: 2019-01-23 10:34

Re: systemd autostart script

Postby Head_on_a_Stick » 2019-01-23 15:51

sickpig wrote:my WM does not have any autostart section in it

Add the desired autostart programs to ~/.xsessionrc, that should be parsed for any GUI session.

For systemd autostart, see this thread:

https://unix.stackexchange.com/question ... th-systemd
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: systemd autostart script

Postby sickpig » 2019-01-23 19:42

Worked like a charm!
Thank you kindly

i had created the systemd service referring to the link suggested by you but no go
i might play with that later
for now my purpose is served thanks to u
cheers
haven = Sir P.G. Wodehouse's books. U havent lived unless u have read one :)
User avatar
sickpig
 
Posts: 314
Joined: 2019-01-23 10:34

Re: systemd autostart script

Postby sickpig » 2019-02-13 23:57

Head_on_a_Stick wrote:
sickpig wrote:For systemd autostart, see this thread:

https://unix.stackexchange.com/question ... th-systemd


finally got around to setting up a functional systemd service to start applications

Head_on_a_Stick thanks for the link but it wasn't of much use. Couldn't get a working service reading that.

The below links are what actually helped. I have listed them in the exact order of their helpfulness:

https://wiki.archlinux.org/index.php/Systemd/User
https://coreos.com/os/docs/latest/sched ... imers.html
https://wiki.archlinux.org/index.php/Systemd/Timers

Will summarize what i did to help folks stumbling upon this post:

create your service in ~/.config/systemd/user/
then follow https://coreos.com/os/docs/latest/sched ... imers.html to create the actual service and the timer
IMP dont forget to activate the timer, because that is what will make the service run. Run systemctl start nameofyour.timer to enable timer.

https://www.freedesktop.org/software/sy ... timer.html should help you understand the timing syntax

Now, time for a controversial statement
Systemd is so great i love it :D :D

I reckon this might bring out the systemd haters
haven = Sir P.G. Wodehouse's books. U havent lived unless u have read one :)
User avatar
sickpig
 
Posts: 314
Joined: 2019-01-23 10:34

Re: systemd autostart script

Postby Head_on_a_Stick » 2019-02-14 07:02

sickpig wrote:Run systemctl start nameofyour.timer to enable timer.

That just starts the .timer, to enable it use
Code: Select all
# systemctl enable nameofyour.timer

sickpig wrote:Systemd is so great i love it

Outrageous :shock:

Do you not long for the good old days when you had to become an expert in scripting with a buggy, bloated, unreliable shell to get services working?
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: systemd autostart script

Postby sickpig » 2019-02-14 09:35

Head_on_a_Stick wrote:
sickpig wrote:Run systemctl start nameofyour.timer to enable timer.

That just starts the .timer, to enable it use
Code: Select all
# systemctl enable nameofyour.timer


you right, in my excitement of posting something useful for a change, I inadvertently skipped that part :D

Head_on_a_Stick wrote:Do you not long for the good old days when you had to become an expert in scripting with a buggy, bloated, unreliable shell to get services working?


hahaha the sarcasm made my day!
haven = Sir P.G. Wodehouse's books. U havent lived unless u have read one :)
User avatar
sickpig
 
Posts: 314
Joined: 2019-01-23 10:34


Return to General Questions

Who is online

Users browsing this forum: No registered users and 10 guests

fashionable