1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-03 04:55:23 +02:00
tldr/pages/common/watchexec.md
2025-05-09 23:16:02 +05:30

940 B

watchexec

Run arbitrary commands when files change. More information: https://manned.org/watchexec.

  • Call ls -la when any file in the current directory changes:

watchexec {{ls -la}}

  • Run make when any JavaScript, CSS and HTML file in the current directory changes:

watchexec {{[-e|--exts]}} {{js,css,html}} make

  • Run make when any file in the lib or src directory changes:

watchexec {{[-w|--watch]}} {{lib}} {{[-w|--watch]}} {{src}} {{make}}

  • Call/restart my_server when any file in the current directory changes, sending SIGKILL to stop the child process:

watchexec {{[-r|--restart]}} --stop-signal {{SIGKILL}} {{my_server}}

  • Restart the execution of a command when any Java source file in the current directory changes, sending SIGKILL and only checking for updates every nms:

watchexec {{[-r|--restart]}} --stop-signal {{SIGKILL}} --poll {{10000}} {{[-e|--exts]}} {{java}} {{command}}