template-watcher.sh (752B)
1 #!/bin/bash 2 3 # Calling the template compiler if a template or a component was modified. 4 # 5 # Need for: 6 # - inotify-tools 7 # - curl 8 # 9 # On Ubuntu/Debian install them with 'apt-get install inotify-tools curl'. 10 # 11 12 CMS_URL=$1 13 14 function update { 15 echo "update started at $(date)" 16 curl -X POST -d "type=all" $1/dev-helper/update.php 17 retVal=$? 18 if [ $retVal -ne 0 ]; then 19 echo "An error occured! Returncode was $retVal" 20 else 21 echo "Sucessful update." 22 fi 23 exit $retVal 24 echo "update ended at $(date)" 25 } 26 27 while true; do 28 # Calling compiler first 29 update 30 31 echo "waiting for changes ..." 32 inotifywait --event modify -r ../modules/template_engine/ ../modules/cms/ui/themes/default/html/views/ 33 echo "a file was changed. updating ..." 34 done 35 36