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

run as a service #95

Open
bcsanford opened this issue Mar 31, 2023 · 1 comment
Open

run as a service #95

bcsanford opened this issue Mar 31, 2023 · 1 comment

Comments

@bcsanford
Copy link

easy method to run when-changed as a (systemd or other type of) service

@mpoberezhniy
Copy link

You can simply create a .service file at /etc/systemd/system/ with the following content:

[Unit]
Description=My description

[Service]
Type=simple
ExecStart=/path/to/when-changed /path/to/watch "${COMMAND_TO_EXECUTE}"
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

In my use case I had to add restart because I am afraid OS can terminate my process after some time but I would not like to let it heppen.

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

2 participants