-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstart-pritunl
executable file
·49 lines (41 loc) · 1.15 KB
/
start-pritunl
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
#!/bin/sh
set -e
[ -d /dev/net ] ||
mkdir -p /dev/net
[ -c /dev/net/tun ] ||
mknod /dev/net/tun c 10 200
touch /var/log/pritunl.log
touch /var/run/pritunl.pid
/bin/rm /var/run/pritunl.pid
## start a local mongodb instance if no mongodb specified through env
if [ -z "$MONGODB_URI" ]; then
/usr/bin/mongod -f /etc/mongod.conf &
sleep 70 ## for mongo to allocate journals
MONGODB_URI="mongodb://localhost:27017/pritunl"
fi
cat << EOF > /etc/pritunl.conf
{
"debug": false,
"log_path": "/var/log/pritunl.log",
"temp_path": "/tmp/pritunl_%r",
"mongodb_uri": "$MONGODB_URI"
}
EOF
#/usr/bin/pritunl start &
#/usr/bin/pritunl set app.reverse_proxy false
#/usr/bin/pritunl set app.redirect_server false
#/usr/bin/pritunl set app.server_ssl true
if [[ "$REVERSE_PROXY" ]]; then
/usr/bin/pritunl set app.reverse_proxy true
fi
if [[ "$NO_REDIRECT_SERVER" ]]; then
/usr/bin/pritunl set app.redirect_server false
fi
if [[ "$NO_SSL" ]]; then
/usr/bin/pritunl set app.server_ssl false
fi
if [[ "$SERVER_PORT" ]]; then
/usr/bin/pritunl set app.server_port $SERVER_PORT
fi
/usr/bin/pritunl start --daemon --pidfile /var/run/pritunl.pid
[ "$1" ] && exec "$@"