You are not logged in.

#1 2016-04-12 11:03:14

stackoverflow
Member
Registered: 2015-09-23
Posts: 43

problem in auto start prime

hi
i want to autostart prime with systemd/timer.and these are my files:

$ sudo nano /etc/systemd/system/prime.service

i wrote in it:

[Unit]
Description=Dual Graphic Technology 

[Service]
Type=oneshot
ExecStart=xrandr --setprovideroffloadsink nouveau Intel

[Install]
RequiredBy=multi-user.targe

and define timer unit:

$ sudo nano /etc/systemd/system/prime.timer

and write:

[Unit]
Description=Run prime.service every boot system

[Timer]
OnBootSec=1min
Unit=prime.service

[Install]
WantedBy=multi-user.target

and enable timer:

sudo systemctl enable prime.timer
sudo systemctl start prime.timer

but when i reboot no action heppen!
and this is status of prime.service:

saeed@saeed ~]$ sudo systemctl status prime.service 
● prime.service - Dual Graphic Technology
   Loaded: loaded (/etc/systemd/system/prime.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sat 2016-04-02 22:07:39 IRDT; 12s ago
  Process: 10951 ExecStart=/home/saeed/Documents/Scripts/prime.sh (code=exited, status=203/EXEC)
 Main PID: 10951 (code=exited, status=203/EXEC)

Apr 02 22:07:39 saeed systemd[1]: Started Dual Graphic Technology.
Apr 02 22:07:39 saeed systemd[1]: prime.service: Main process exited, code=exited, status=203/EXEC
Apr 02 22:07:39 saeed systemd[1]: prime.service: Unit entered failed state.
Apr 02 22:07:39 saeed systemd[1]: prime.service: Failed with result 'exit-code'.

any idea?

Offline

#2 2016-04-12 11:58:30

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,922

Re: problem in auto start prime

xrandr commands only work AFTER X has started .

There are logical places to put this command, like ~/.xinitrc for startx users, and autostart functionality for display managers.

IF you insist on using a systemd timer to run the xrandr command :

Have the timer fire after graphical.target has been reached but before your display manager starts.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2016-04-12 12:02:07

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: problem in auto start prime

in addition to what has been said above, you will need to use absolute path with systemd, so simply "xrandr" will not work.

Offline

#4 2016-04-12 16:42:43

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

Re: problem in auto start prime

Not a Sysadmin issue, moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB