forked from johnae/pritunl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-pritunl
executable file
·38 lines (32 loc) · 922 Bytes
/
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
#!/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/mongodb.conf &
sleep 70 ## for mongo to allocate journals
MONGODB_URI="mongodb://localhost:27017/pritunl"
fi
cat << EOF > /etc/pritunl.conf
{
"mongodb_uri": "$MONGODB_URI",
"server_key_path": "/var/lib/pritunl/pritunl.key",
"log_path": "/var/log/pritunl.log",
"static_cache": true,
"server_cert_path": "/var/lib/pritunl/pritunl.crt",
"temp_path": "/tmp/pritunl_%r",
"bind_addr": "0.0.0.0",
"debug": false,
"www_path": "/usr/share/pritunl/www",
"local_address_interface": "auto",
"port": 9700
}
EOF
/usr/bin/pritunl start &
[ "$1" ] && exec "$@"