-
Notifications
You must be signed in to change notification settings - Fork 0
/
nbws
executable file
·33 lines (23 loc) · 822 Bytes
/
nbws
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
#!/bin/bash
# Get location of nbws
# from Dave Dopson at http://stackoverflow.com/a/246128/986793
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
export TMP=$(mktemp -u)
mkfifo $TMP.fifo
export BROWSER="echo >$TMP.fifo"
cd "$DIR"
python -m mod_pywebsocket.standalone -p 8888 -d . &
echo $! >$TMP.pid
cd -
echo please visit http://$(hostname):8888
sleep 3
newsbeuter
echo $TMP $TMP.pid $TMP.fifo "'$BROWSER'"
kill $(<$TMP.pid)
rm $TMP.pid $TMP.fifo