Skip to content

Instantly share code, notes, and snippets.

View osrec's full-sized avatar
🎯
Focusing

OSREC Technologies osrec

🎯
Focusing
View GitHub Profile
@osrec
osrec / runWatch.sh
Created August 6, 2018 21:31
Watch a particular directory for changes and kill and restart a process on change
# In the example below, the command we want to run is `php -f "$DIR/../run.php"` - change this on lines 30 and 46
# $DIR is just the directory containing this script file (computed automatically, but you can hardcode it if you want).
# Use $DIR to specify paths relative to the script's path.
# The PROCESS_NAME variable is the name of the process to kill and restart
# You must ensure your process has the same name each time it runs (we use a file at $DIR/../servername to store the name)
# Alternatively, you can hard code the PROCESS_NAME on line 15 if you like
#!/bin/bash