Summary Files Commits Branches @commit @diff @stats
path: root / tools
diff options
context:
space:
mode:
2 files changed, 40 insertions, 0 deletions
-rwxr-xr-xtools/move-to-www.sh16
-rwxr-xr-xtools/watch-move-to-www.sh24
diff --git a/tools/move-to-www.sh b/tools/move-to-www.sh
new file mode 100755
index 0000000..ee13725
--- /dev/null
+++ b/tools/move-to-www.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+if [ "$EUID" -ne 0 ]; then
+ echo "Please run as root"
+ exit
+fi
+
+DEFAULT_DIR="/var/www/devrix-job-board/"
+
+if [ ! -d "$DEFAULT_DIR" ]; then
+ mkdir $DEFAULT_DIR
+ chown www-data:www-data $DEFAULT_DIR
+fi
+
+cp -R ../src/. $DEFAULT_DIR
+chown -R www-data:www-data $DEFAULT_DIR*
diff --git a/tools/watch-move-to-www.sh b/tools/watch-move-to-www.sh
new file mode 100755
index 0000000..db120b8
--- /dev/null
+++ b/tools/watch-move-to-www.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+if ! type "inotifywait" > /dev/null; then
+ echo "You'll need to install inotify-tools!"
+fi
+
+if [ "$EUID" -ne 0 ]; then
+ echo "Please run as root!"
+ exit
+fi
+
+DEFAULT_DIR="/var/www/devrix-job-board/"
+
+if [ ! -d "$DEFAULT_DIR" ]; then
+ mkdir $DEFAULT_DIR
+ chown www-data:www-data $DEFAULT_DIR
+fi
+
+inotifywait -m ../src/ -r -e attrib -e create -e move -e delete |
+ while read dir action file; do
+ echo "[`date +"%Y-%m-%d %T"`] Updated folder"
+ cp -R ../src/. $DEFAULT_DIR
+ chown -R www-data:www-data $DEFAULT_DIR*
+ done