Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemctl wrapper to restart ioc2rpz when config file is changed #51

Open
dmgeurts opened this issue Nov 14, 2023 · 0 comments
Open

systemctl wrapper to restart ioc2rpz when config file is changed #51

dmgeurts opened this issue Nov 14, 2023 · 0 comments

Comments

@dmgeurts
Copy link

dmgeurts commented Nov 14, 2023

For those interested in automatically restarting ioc2rpz

Create a new watcher restart service:

sudo systemctl edit --force --full ioc2rpz-cfg-watcher.service

[Unit]
Description=ioc2rpz restarter
After=network.target
StartLimitIntervalSec=10
StartLimitBurst=5

[Service]
Type=oneshot
ExecStart=/usr/bin/docker compose -f /opt/ioc2rpz.dc/docker-compose.yml restart ioc2rpz

[Install]
WantedBy=multi-user.target

Create a new watcher path service:

sudo systemctl edit --force --full ioc2rpz-cfg-watcher.path

[Path]
Unit=ioc2rpz-cfg-watcher.service
PathChanged=/opt/ioc2rpz/cfg/ioc2rpz.conf

[Install]
WantedBy=multi-user.target

Enable and start the new services:

sudo systemctl enable --now ioc2rpz-cfg-watcher.{path,service}

Check the new services with:

sudo systemctl status ioc2rpz-cfg-watcher
sudo systemctl status ioc2rpz-cfg-path

Now edit the config file and observe whether ioc2rpz is restarted

sudo journalctl -fu docker

And then edit the config file, by changing the time stamp in the first line of the config file (the comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant