You are not logged in.

#1 2015-04-08 16:49:16

dwsmith
Member
Registered: 2015-04-07
Posts: 18

[Solved] Setting up a systemd configuration to run on machine boot

I have been trying to set up the following configuration. I have bash script in

/usr/local/bin

which I chmod and gave the correct permissions. The script is simple

    #!/bin/bash
    sleep 15 && conky -c ~/.conky/.conkyrc &
    sleep 15 && conky -c ~/.conky/.todoconkyrc

Then I created in a system file in

/usr/lib/systemd/system

called conky-start

    [Unit]
    Description = Start multiple conkyrc files

    [Service]
    WorkingDirectory=/usr/local/bin
    Type=forking # but I have tried oneshot as well
    ExecStart=/bin/bash conky-start
    RemainAfterExit=yes

    [Install]
    WantedBy=multi-user.target # I dont really understand the options here since they arent listed on archlinux wiki systemd page

I did look at Systemd but that doesn't clarify much. I decided to use multi-user-target since it was listed in the FAQs.

When I check systemctl, it reads out

    conky.service             loaded activating start     start Start multiple conky

but nothing happens. In the script, I added the 15sec delay so there wouldn't be any issues with dependencies and what not, not being loaded. I have an SSD so I think 15secs is more than adequate.

My question is how can I get this bash script to execute on boot? If I open the terminal and execute

/usr/local/bin/conky-start,

the script executes with no problems so the issue has to be in the system file I created.

Last edited by dwsmith (2015-04-08 17:56:02)

Offline

#2 2015-04-08 17:24:28

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [Solved] Setting up a systemd configuration to run on machine boot

What are the conky configs doing? If they are drawing stuff and thus need a running X server, why don't you start this in ~/.xinitrc or some similar startup script for whatever WM/DE you're using? If they need X and you insist on using systemd, you want a user service and you need to at least get $DISPLAY set.

If they only output things to files, then you can more or less use it like this, but multiple things need fixing/improving.

Offline

#3 2015-04-08 17:26:13

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: [Solved] Setting up a systemd configuration to run on machine boot

What WM (or DE) are you using? This kind of thing is usually either run in .xinitrc or the startup file for your WM.

(edit) -- what Raynman said :-)

Last edited by 2ManyDogs (2015-04-08 17:27:01)

Offline

#4 2015-04-08 17:32:51

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [Solved] Setting up a systemd configuration to run on machine boot

Raynman and 2ManyDogs are on target, but I just want to point out:

1) You should put custom services in /etc/systemd/system/
2) There is a typo in your service file:

WantedBy=multi-user.targert


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#5 2015-04-08 17:33:57

dwsmith
Member
Registered: 2015-04-07
Posts: 18

Re: [Solved] Setting up a systemd configuration to run on machine boot

I am using gnome. Where would I put the script in the gnome then?

Offline

#6 2015-04-08 17:34:51

dwsmith
Member
Registered: 2015-04-07
Posts: 18

Re: [Solved] Setting up a systemd configuration to run on machine boot

alphaniner wrote:

Raynman and 2ManyDogs are on target, but I just want to point out:

1) You should put custom services in /etc/systemd/system/
2) There is a typo in your service file:

WantedBy=multi-user.targert

The typo is just here not in the file.

Offline

#7 2015-04-08 17:47:59

dwsmith
Member
Registered: 2015-04-07
Posts: 18

Re: [Solved] Setting up a systemd configuration to run on machine boot

So I created in ~/.config/autostart/conky.desktop

[Desktop Entry]
Name=Conky
Type=Application
Exec=/usr/local/bin/conky-start
Terminal=false
Comment=Start multiple conkyrc files.

I will test this out and see if it works.

Okay so this worked. I dont see how to mark the thread solved though.

Last edited by dwsmith (2015-04-08 17:49:48)

Offline

#8 2015-04-08 17:51:31

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: [Solved] Setting up a systemd configuration to run on machine boot

Again, what WM are you using? It would be much simpler to just put the two conky start lines in your .xinitrc, or in the autostart file for the WM (if it has one). You are making this more difficult than it needs to be.

(edit) never mind, I see you are using GNOME. I know nothing about GNOME, so I will go away now. :-)

(edit2) -- to mark the thread SOLVED, just edit the title of your first post.

Last edited by 2ManyDogs (2015-04-08 17:54:50)

Offline

#9 2015-04-08 18:10:47

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] Setting up a systemd configuration to run on machine boot

dwsmith wrote:

I dont see how to mark the thread solved though.

Welcome to the forum, please familiarize yourself with the stickied topics: https://bbs.archlinux.org/viewtopic.php?id=130309

Offline

Board footer

Powered by FluxBB