refreshes firefox on file changes (developping)
When you develop web apps you need to view changes so you save the file move to the web browser and then refresh the web browser.
This script makes things a lot easier. It uses inotify-tools and netcat and it need the firefox addon: remote-control, get it from this link: https://addons.mozilla.org/en-US/firefox/addon/remote-control/
-
add remote-control plugin to firefox https://addons.mozilla.org/en-US/firefox/addon/remote-control/
-
install inotify-tools
-
install netcat
-
open ~/.bashrc and paste the following:
function roc() { echo reload | nc -c localhost 32000; }; function odc() { while true; do inotifywait $(find . -type d); roc; done; }
-
source ~/.bashrc
-
open a new tab in the terminal,
cd
to the directory that contains web files and runodc
-
open the page in the browser (and activate the addon)
you can sync a folder with your local host folder with the following additional steps:
-
install async
-
modify what you have pasted in ~/.bashrc accordingly:
function roc() { sudo rsync -avz --delete . /opt/lampp/htdocs/; echo reload | nc -c localhost 32000; }; function odc() { while true; do inotifywait $(find . -type d); roc; done; }