-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·78 lines (64 loc) · 1.38 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
SERVER=localhost
DOCROOT=/var/www/html/
SOURCE=~/output.xml
SLEEPTIME=5
function deployHTML {
xsltproc lv2rdf2html.xsl "$SOURCE" \
| xsltproc xml-prettyprint.xsl - \
| ssh $SERVER "cat > '$DOCROOT'/index.html"
}
function watchHTML {
while : ; do
inotifywait -e modify lv2rdf2html.xsl iterators.xsl gui-*.xsl "$SOURCE";
deployHTML
sleep $SLEEPTIME
done
}
function deployPHP {
xsltproc lv2rdf2php.xsl "$SOURCE" \
| ssh $SERVER "cat > '$DOCROOT'/pluginController.php"
}
function watchPHP {
while : ; do
inotifywait -e modify lv2rdf2php.xsl "$SOURCE";
deployPHP
sleep $SLEEPTIME
done
}
function deployOther {
scp *css *js $SERVER:"$DOCROOT"
}
function watchOther {
while : ; do
inotifywait -e modify *css *js ;
deployOther
sleep $SLEEPTIME
done
}
echo "Initial deployment of all files:"
echo -n "HTML code... "
deployHTML && echo "done." || echo "failed."
echo -n "PHP code... "
deployPHP && echo "done." || echo "failed."
echo "CSS and Javascript... "
deployOther && echo "done." || echo "failed."
echo "Hit Control-C to terminate $0."
watchHTML &
watchHTML_PID="$!"
watchPHP &
watchPHP_PID="$!"
watchOther &
watchOther_PID="$!"
function user_break {
echo "Ok, preparing to exit..."
kill $watchHTML_PID
kill $watchPHP_PID
kill $watchOther_PID
echo "Cleaned up, goodbye!"
exit 0;
}
trap user_break SIGINT
while : ; do
sleep 60
done