You are not logged in.

#1 2014-10-22 15:40:14

PReP
Member
From: Sweden
Registered: 2010-06-13
Posts: 359
Website

[SOLVED] systemd timers running custom script - help

Hello there all.

I am trying to get my mind wrapped around the usage of systemd timers.
In this case i am trying to get a random wallpaper-changer script of mine run every 30 mins or so.

These are the involved files:

> - randomwall.timer:

[Unit]
Description=Random Wallpaper Timer

[Timer]
OnBootSec=1min
OnCalendar=*:0/30
Unit=randomwall.service

[Install]
WantedBy=default.target

> - randomwall.service:

[Unit]
Description=Random Wallpaper 30 Mins
Wants=randomwall.timer
RefuseManualStart=no
RefuseManualStop=yes

[Service]
Type=oneshot
ExecStart=/home/prep/bin/new_wall_pic

[Install]
WantedBy=randomwall.timer

> /home/prep/bin/new_wall_pic:

#!/bin/bash

# Random Conky-Pic

feh --randomize --bg-max /home/prep/pics/use/*

Result of systemctl status on the service file:

randomwall.service - Random Wallpaper 30 Mins
   Loaded: loaded (/etc/systemd/system/randomwall.service; enabled)
   Active: failed (Result: exit-code) since Wed 2014-10-22 17:30:10 CEST; 7min ago
  Process: 20166 ExecStart=/home/prep/new_wall_pic (code=exited, status=203/EXEC)
 Main PID: 20166 (code=exited, status=203/EXEC)

Oct 22 17:30:10 preptus systemd[1]: randomwall.service: main process exited, code=exited, status=203/EXEC
Oct 22 17:30:10 preptus systemd[1]: Failed to start Random Wallpaper 30 Mins.
Oct 22 17:30:10 preptus systemd[1]: Unit randomwall.service entered failed state.

There are probably something i am missing here, and i am not sure if i am allowed to run a script from my home folder this way?
Any help heavily appreciated! smile

Last edited by PReP (2014-12-14 22:01:45)


. Main: Intel Core i5 6600k @ 4.4 Ghz, 16 GB DDR4 XMP, Gefore GTX 970 (Gainward Phantom) - Arch Linux 64-Bit
. Server: Intel Core i5 2500k @ 3.9 Ghz, 8 GB DDR2-XMP RAM @ 1600 Mhz, Geforce GTX 570 (Gainward Phantom) - Arch Linux 64-Bit
. Body: Estrogen @ 90%, Testestorone @ 10% (Not scientific just out-of-my-guesstimate-brain)

Offline

#2 2014-10-22 20:51:16

PReP
Member
From: Sweden
Registered: 2010-06-13
Posts: 359
Website

Re: [SOLVED] systemd timers running custom script - help

Alright, i got it figured out now, sorry for the space-waste.

First i had to get around making it a systemd --user session service and timer instead.
And after that make sure that it got attached to the xsession (i.e Environment=DISPLAY=:0) in the service file.

Of course the information was available in our great wiki, i just did not know to have a look there when i started.

Marking as solved! smile

Last edited by PReP (2014-12-14 22:00:57)


. Main: Intel Core i5 6600k @ 4.4 Ghz, 16 GB DDR4 XMP, Gefore GTX 970 (Gainward Phantom) - Arch Linux 64-Bit
. Server: Intel Core i5 2500k @ 3.9 Ghz, 8 GB DDR2-XMP RAM @ 1600 Mhz, Geforce GTX 570 (Gainward Phantom) - Arch Linux 64-Bit
. Body: Estrogen @ 90%, Testestorone @ 10% (Not scientific just out-of-my-guesstimate-brain)

Offline

Board footer

Powered by FluxBB