git://git.onelab.eu
/
myslice.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
aed0ffd
)
kill server when port is already used
demo
author
Anthony Garcia
<anthony.garcia@inria.fr>
Mon, 30 Sep 2013 10:55:32 +0000
(12:55 +0200)
committer
Anthony Garcia
<anthony.garcia@inria.fr>
Mon, 30 Sep 2013 10:55:32 +0000
(12:55 +0200)
devel/server-loop.sh
patch
|
blob
|
history
diff --git
a/devel/server-loop.sh
b/devel/server-loop.sh
index
1ac43e4
..
31cf0d8
100755
(executable)
--- a/
devel/server-loop.sh
+++ b/
devel/server-loop.sh
@@
-10,6
+10,11
@@
while true; do
# we use make for convenience
# but what the static target really does is to invoke manage.py collectstatic
make static templates
# we use make for convenience
# but what the static target really does is to invoke manage.py collectstatic
make static templates
+
+ # if port is already used, we kill the server
+ pid=$(netstat -putan | awk "\$4 == \"0.0.0.0:$port\" && \$7 != \"-\" {split(\$7,a,\"/\"); print a[1]}")
+ [[ -n "$pid" ]] && kill $pid
+
./manage.py runserver 0.0.0.0:$port
sleep 1
done
./manage.py runserver 0.0.0.0:$port
sleep 1
done