Intro
In my gnome desktop, I have a script that run at login to random a new wallpaper. I still want to change wallpaper every 30 minutes. So systemd timer is created to do the job.
Use a systemd timer
-
create directory at
~/.config/systemd/user -
create wallpaper.service
[Unit]
Description=Random Wallpaper Script
[Service]
ExecStart=/path/to/script/random_wallpaper_gnome_v2.shwhen task is running, the random_wallpaper_gnome_v2.sh will be executed.
- create wallpaper.timer
[Unit]
Description=Run wallpaper task every 30 minutes after start
[Timer]
OnActiveSec=30min
OnUnitActiveSec=30min
[Install]
WantedBy=timers.targetOnActiveSec will activate the task 30 minutes after timer is started.
OnUnitActiveSec will activate again in 30 minutes after task is finished.
- Enable and start timer.
systemctl --user daemon-reload
systemctl --user enable wallpaper.timer
systemctl --user start wallpaper.timer