Watchfolders - Part 3
Create the watcher systemd service
Now that we have a watcher script, we need the systemd service that will control the script. This will make sure the process runs after a reboot.
The systemd service directory is /usr/lib/systemd/system/
Make sure to change the variables to match your watcher script name
[Unit]
Description = Watcher Description
[Service]
Type=oneshot
ExecStart=/usr/lib/systemd/scripts/watcher_Script start
ExecStop=/usr/lib/systemd/scripts/watcher_Script stop
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Now that we have this set as a systemd service we can control it using systemctl:
Enable Watcher (to start at boot):
systemctl enable Watcher_INTERFACE_Template
Start Watcher:
systemctl start Watcher_INTERFACE_Template
Stop Watcher:
systemctl stop Watcher_INTERFACE_Template
Restart Watcher:
systemctl restart Watcher_INTERFACE_Template