File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 1010# USAGE: sh nginx-watch.sh
1111
1212# Set NGINX directory
13- dir=` dirname $0 `
13+ # tar command already has the leading /
14+ dir=' etc/nginx'
1415
1516# Get initial checksum values
16- checksum_initial=` tar -cf - $dir | md5sum | awk ' {print $1}' `
17+ checksum_initial=$( tar --strip-components=2 -C / - cf - $dir | md5sum | awk ' {print $1}' )
1718checksum_now=$checksum_initial
1819
1920# Start nginx
2425# the nginx configuration is tested and reloaded on success
2526while true
2627do
27- checksum_now=` tar -cf - $dir | md5sum | awk ' {print $1}' `
28+ checksum_now=$( tar --strip-components=2 -C / - cf - $dir | md5sum | awk ' {print $1}' )
2829
2930 if [ $checksum_initial != $checksum_now ]; then
3031 echo ' [ NGINX ] A configuration file changed. Reloading...'
You can’t perform that action at this time.
0 commit comments