Skip to content

Recommended Systemd Services #18

@grav3m1nd-byte

Description

@grav3m1nd-byte

I thought of contributing here as I like this autoplank instance. From how I had it before by using another autoplank iteration, using systemd is probably the better way to go about it.

If you like my recommendations, feel free to add it to your README @abiosoft

Here are my suggestions and take them for what is worth.

  1. Create the service file as user, and the desired polling. Do not enable this service:
$ cat $HOME/.config/systemd/user/autoplank.service
[Unit]
Description=Autoplank Service

[Service]
ExecStart=/usr/local/bin/autoplank -p 200
Restart=always

[Install]
WantedBy=default.target
  1. Create a systemd timer for this service and make the timer trigger the service:
$ cat $HOME/.config/systemd/user/autoplank.timer  
[Unit]
Description=Timer for the AutoPlank user-mode service

[Timer]
OnActiveSec=5
Unit=autoplank.service

[Install]
WantedBy=timers.target

Additionally:
3. Create a new service to rescan and configure it to run once:

$ cat $HOME/.config/systemd/user/autoplank_scan.service 
[Unit]
Description=Autoplank Monitor Scan Service
Wants=autoplank_scan.timer

[Service]
Type=oneshot
ExecStart=/usr/local/bin/autoplank -r

[Install]
WantedBy=default.target
  1. Create a new systemd timer to trigger this rescanner. I set this to run every minute, be persistent, and to depend on the autoplank.service:
$ cat $HOME/.config/systemd/user/autoplank_scan.timer 
[Unit]
Description=Timer for the AutoPlank Scan user-mode service
Requires=autoplank.service
After=autoplank.service

[Timer]
OnCalendar=*-*-* *:*:00
Persistent=true
AccuracySec=1s

Unit=autoplank_scan.service

[Install]
WantedBy=timers.target
  1. Enable ONLY the timers and not the services and start them. Consider the dependency when starting the timers:
$ systemctl enable autoplank.timer --user
$ systemctl enable autoplank_scan.timer --user
$ systemctl start autoplank.timer --user
$ systemctl start autoplank_scan.timer --user

Note: the services will show up as Loaded but inactive, and this is fine. Both services should show they are triggered by their timers:

  • Service status:

image

image

  • Timer Status:

image

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions