You are not logged in.

#1 2013-02-13 15:14:38

agruss92
Member
Registered: 2013-02-13
Posts: 4

systemd script

I wrote a service file to start the trackpad on my laptop when it boots. It executes a script I put in /bin that by itself works fine.
This is the script:
#!/bin/sh

xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation" 8 1
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Button" 8 2
#xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Timeout" 8 200
xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Axes" 8 6 7 4 5

and here is the service file
[Unit]
Description=Starts trackpoint script
After=display-manager.service

[Service]
ExecStart=/bin/trackpoint

[Install]
WantedBy=multi-user.target

when I add it to be started and reboot, it does not work. The following is the output of systemctl status trackpoint.service

trackpoint.service - Starts trackpoint script
      Loaded: loaded (/etc/systemd/system/trackpoint.service; enabled)
      Active: failed (Result: exit-code) since Wed 2013-02-13 10:04:01 EST; 9min ago
     Process: 391 ExecStart=/bin/trackpoint (code=exited, status=1/FAILURE)

Feb 13 10:04:01 thinkpad trackpoint[391]: Unable to connect to X server
Feb 13 10:04:01 thinkpad trackpoint[391]: Unable to connect to X server
Feb 13 10:04:01 thinkpad trackpoint[391]: Unable to connect to X server

I'm not sure if there is something wrong with the script, which works when executed normally, or if it is my service file. Any help would be greatly appreciated.

Offline

#2 2013-02-13 15:44:21

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: systemd script

I'm assuming that xinput requires x to be running?
If so, you're probably best off putting those commands in .xinitrc. The systemd multi-user.target is recahed before X starts.
You could look into when the graphical target is reached, if you boot directly into X as that may be after X is started.


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#3 2013-02-13 16:27:34

agruss92
Member
Registered: 2013-02-13
Posts: 4

Re: systemd script

skanky wrote:

I'm assuming that xinput requires x to be running?
If so, you're probably best off putting those commands in .xinitrc. The systemd multi-user.target is recahed before X starts.
You could look into when the graphical target is reached, if you boot directly into X as that may be after X is started.

I tried putting the script into .xinitrc, and the commands individually, and none of it worked. I also played around with the target a bit and that didn't change anything. It might just be that xinput is a bad way of doing what I'm trying to do, so I am going to look in to other solutions as well as trying to get this one to work.

Offline

#4 2013-02-13 16:31:39

kaszak696
Member
Registered: 2009-05-26
Posts: 543

Re: systemd script

First off, what display manager and DE are you using? Some of them ignore .xinitrc.
Make sure to put these comand before the line that starts your window manager.


'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard

Offline

#5 2013-02-13 16:35:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,332
Website

Re: systemd script

I also recommend .xinitrc, but if you want to use a service file, you'll need to include the User= line and ensure it runs after X is running.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Online

#6 2013-02-13 18:15:29

agruss92
Member
Registered: 2013-02-13
Posts: 4

Re: systemd script

It seems like the service file is a bad idea. My .xinitrc is posted below, what should I add and where to execute the script? Or should I just add the lines in the script directly to it?

#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

exec gnome-session-cinnamon
# exec startkde
# exec startxfce4
# ...or the Window Manager of your choice

Offline

#7 2013-02-13 20:58:30

moetunes
Member
From: A comfortable couch
Registered: 2010-10-09
Posts: 1,033

Re: systemd script


You're just jealous because the voices only talk to me.

Offline

#8 2013-02-13 21:45:28

chris_l
Member
Registered: 2010-12-01
Posts: 390

Re: systemd script

If you want to do it with systemd, you have to use systemd user session.


"open source is about choice"
No.
Open source is about opening the source code complying with this conditions, period. The ability to choose among several packages is just a nice side effect.

Offline

#9 2013-02-14 02:06:37

agruss92
Member
Registered: 2013-02-13
Posts: 4

Re: systemd script

moetunes wrote:

Thanks, that did it, and it was much simpler.

Offline

Board footer

Powered by FluxBB