-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
49 lines (40 loc) · 1.46 KB
/
install.sh
File metadata and controls
49 lines (40 loc) · 1.46 KB
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
#!/usr/bin/env sh
RUN=/var/run/NiceProxy/
NICEPROXY=/usr/app/NiceProxy/
LOG=/var/log/NiceProxy/
SERVICE=/usr/lib/systemd/system/NiceProxy.service
useradd -M -s /sbin/nologin NiceProxy
mkdir -p $NICEPROXY
mkdir -p $LOG
chown -R NiceProxy:NiceProxy $LOG
chmod -R +w $LOG
mkdir -p $RUN
chown -R NiceProxy:NiceProxy $RUN
chmod -R +w $RUN
echo "Copying files..."
cp -Rf NiceProxy.py ${NICEPROXY}NiceProxy
chmod +x ${NICEPROXY}NiceProxy
echo "Copy files done."
echo "generating keys..."
mkdir ${NICEPROXY}keys
openssl req -new -x509 -days 3650 -nodes -out ${NICEPROXY}keys/cert.pem -keyout ${NICEPROXY}keys/key.pem
echo "generating keys done"
chown -R NiceProxy:NiceProxy $NICEPROXY
chmod -R 755 $NICEPROXY
echo "Writing NiceProxy.service..."
echo "" > $SERVICE
chmod 755 $SERVICE
echo "[Unit]" >>$SERVICE
echo "Description=NiceProxy" >>$SERVICE
echo "After=network.target" >>$SERVICE
echo "" >>$SERVICE
echo "[Service]" >>$SERVICE
echo "Type=forking" >>$SERVICE
echo "PIDFile=${RUN}NiceProxy.pid" >>$SERVICE
echo "ExecStart=${NICEPROXY}NiceProxy" >>$SERVICE
echo "" >>$SERVICE
echo "[Install]" >>$SERVICE
echo "WantedBy=mutil-user.target" >>$SERVICE
echo "" >>$SERVICE
chmod 754 $SERVICE
echo "Write NiceProxy.service done"