You are not logged in.

#1 2015-02-02 05:18:05

Mosttoast
Member
Registered: 2015-02-02
Posts: 7

Running executable with systemd

hello all I have an executable i can click to start my vnc looks like

#!/usr/bin/sh -
x0vncserver -display :0 -passwordfile ~/.vnc/passwd

It is named blamnet.sh Then I have a systemd file looks like


[Unit]
Description=blamnet

[Service]
Type=simple
ExecStart=/usr/bin/blamnet.sh
KillMode=process

[Install]
WantedBy=graphical.target

it is named blamnet.service I really just want to run it after my network connects but when i do
systemctl enable blamnet
then
systemctl start blamnet
it appers to start but no vnc server
can anyone point me in the right direction?

Last edited by Mosttoast (2015-02-02 05:40:46)

Offline

#2 2015-02-02 05:21:40

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Running executable with systemd

Please use code tags when pasting to the boards: https://wiki.archlinux.org/index.php/Fo … s_and_Code


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2015-02-02 05:41:18

Mosttoast
Member
Registered: 2015-02-02
Posts: 7

Re: Running executable with systemd

so.... you got an answer?
thank you for the tip on posting code

Last edited by Mosttoast (2015-02-02 05:43:25)

Offline

#4 2015-02-02 06:16:37

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Running executable with systemd

The answer would come from a combination of establishing why your service fails (`systemctl status -l yourservice.service`) and `man systemd.service`...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2015-02-02 06:32:50

Mosttoast
Member
Registered: 2015-02-02
Posts: 7

Re: Running executable with systemd

here is the result of

systemctl status -l blamnet.service
 blamnet.service - blamnet
   Loaded: loaded (/etc/systemd/system/blamnet.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2015-02-02 05:49:26 UTC; 39min ago
  Process: 557 ExecStart=/usr/bin/blamnet.sh (code=exited, status=1/FAILURE)
 Main PID: 557 (code=exited, status=1/FAILURE)

what should I be looking for? I don't see any kind of error code or description of failure unless 1/failure is it

Last edited by Mosttoast (2015-02-02 06:41:48)

Offline

#6 2015-02-02 06:42:55

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Running executable with systemd

Are you not going to make any effort to solve this yourself?

Read the wiki page, there is an example service file there...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#7 2015-02-02 06:48:31

Mosttoast
Member
Registered: 2015-02-02
Posts: 7

Re: Running executable with systemd

I have tried ever form of .target and i have tried many examples. i have changed to all types and i started with the example off the wiki page. Perhaps I need to be more specific...  but i don't know why it wont work.

Offline

#8 2015-02-02 06:52:26

nullified
Member
From: Massachusetts, USA
Registered: 2013-12-09
Posts: 468

Re: Running executable with systemd

Spend more time on the wiki...the systemd entry gives clear guidance for what you ought to do to investigate further.


"We may say most aptly, that the Analytical Engine weaves algebraical patterns just as the Jacquard-loom weaves flowers and leaves." - Ada Lovelace

Offline

#9 2015-02-02 06:53:49

Mosttoast
Member
Registered: 2015-02-02
Posts: 7

Re: Running executable with systemd

here is example of vnc wiki

[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=simple
User=
PAMName=login

# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver -geometry 1440x900 -fg -alwaysshared -dpi 100 %i
ExecStop=/usr/bin/vncserver -kill %i

[Install]
WantedBy=multi-user.target

I tried it with my user pluged in and it will not work, but it's not what i want to do anyway i just want to run the executable i made after start up I think my problem is that it needs to be forking since my executable starts a vnc server, but i guess maybe i dont know how to fork it.

Offline

#10 2015-02-02 07:01:10

Mosttoast
Member
Registered: 2015-02-02
Posts: 7

Re: Running executable with systemd

thanks nullifiedi tried that throuble shooting thing and i got this

journalctl _PID=557
-- Logs begin at Sat 2015-01-03 19:39:40 UTC, end at Mon 2015-02-02 06:27:59 UTC
lines 1-1/1 (END)

i press down and get a bunch of ~ do i just not know how to read journal? seems blank but on their example it is not.

Offline

#11 2015-02-02 07:18:15

Mosttoast
Member
Registered: 2015-02-02
Posts: 7

Re: Running executable with systemd

Thanks guys I tried ending process restarting and getting new PID journal still blank. Perhaps i need sudo too read or something but I'm spent today. I do thank you and I understand your frustrated because I do not fully understand the wiki. I was hoping you could see my error from my code, but I will return to studying systemd as advised.

Last edited by Mosttoast (2015-02-02 07:21:20)

Offline

Board footer

Powered by FluxBB