Shell script fails when executed by systemd service

خرید بک لینک

So I have a systemd service called startup.service:

[Unit]
Description=startup scripts

[Service]
Type=oneshot
ExecStart=/home/user/Documents/Tools/Scripts/startup.sh

[Install]
WantedBy=multi-user.target

that calls a script called startup.sh:

#! /bin/sh -
DIR='/home/user/Documents/Tools/Scripts'
$DIR/audio.sh
$DIR/powertop.sh
$DIR/xinput.sh

which calls a script called xinput.sh:

export DISPLAY=:0.0 if xinput set-prop 11 297 -107 -107; then echo "done!" fi

When I run startup.sh as root, xinput.sh retus "done!" and correctly changes the settings. When I run startup.service as root, xinput fails and retus:

Jun 23 22:37:45 localhost startup.sh[7051]: No protocol specified
Jun 23 22:37:45 localhost startup.sh[7051]: Unable to connect to X server

(This is all after X has started)

What's the difference? Why is this happening?

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 280 تاريخ: جمعه 4 تير 1395 ساعت: 11:12

صفحه بندی