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

watchexec fails to detect changes in file on the server #861

Open
myugan opened this issue Aug 22, 2024 · 3 comments
Open

watchexec fails to detect changes in file on the server #861

myugan opened this issue Aug 22, 2024 · 3 comments

Comments

@myugan
Copy link

myugan commented Aug 22, 2024

Information:

  • Watchexec's version: 2.1.2
  • The OS you're using Ubuntu 22.04
  • The command: watchexec -q -w /etc/nginx/conf.d/*.template nginx -s reload

I'm using watchexec to monitor the base template of nginx in the Docker image I created. This setup ensures that any modifications trigger the generation of a new configuration and subsequently reload nginx. Locally, on my MacOS, this setup works perfectly with Docker Compose, using the following volume configuration:

volumes:
  - ./etc/conf.d/local/:/etc/nginx/conf.d/

However, when I deploy this setup on a server, where the code is pulled from a git repository, updates from the repository should modify the source code on the server. Despite this, watchexec seems unable to detect changes to /etc/nginx/conf.d/*.template, even when the contents are altered.

@myugan myugan added the bug Something's not right! label Aug 22, 2024
@passcod passcod removed the bug Something's not right! label Aug 22, 2024
@passcod
Copy link
Member

passcod commented Aug 22, 2024

uhh, can you paste the exact command you're using? what you've pasted shouldn't work at all, unless you've got a single .template file.

In any case, as described in the documentation, watch the folder and filter, don't watch individual files.

@myugan
Copy link
Author

myugan commented Aug 22, 2024

I use the command watchexec -w /etc/nginx/conf.d/*.template. Is the wildcard causing the issue? My goal is to have my own custom script that reads /etc/nginx/conf.d/default.conf.template and generates the configuration file /etc/nginx/conf.d/default.conf in the end.

I am wondering if the command I used above is working for the local setup, but it is not producing the same result on the live server.

@passcod
Copy link
Member

passcod commented Aug 22, 2024

Yes, the wildcard is interpreted by your shell, not by watchexec, so you'll end up with

watchexec -w /etc/nginx/conf.d/foo.template /etc/nginx/conf.d/bar.template

which will of course try to watch foo.template and run bar.template

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