-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·40 lines (35 loc) · 1.03 KB
/
Copy pathstart.sh
File metadata and controls
executable file
·40 lines (35 loc) · 1.03 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
#!/bin/sh
if [ ! -d /etc/letsencrypt/live/g.yifei.me/ ]; then
/opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx_http_only.conf
mkdir -p /opt/nginx/html/.well-known/acme-challenge
certbot certonly --webroot --agree-tos --no-eff-email --email kongyifei@gmail.com \
-w /opt/nginx/html -d gg.yifei.me
/opt/nginx/sbin/nginx -s quit
fi
# start nginx
/opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf
status=$?
if [ $status -ne 0 ]; then
echo "Failed to start nginx: $status"
exit $status
fi
# start certbot cron
crond
status=$?
if [ $status -ne 0 ]; then
echo "Failed to start crond: $status"
exit $status
fi
while true; do
#ps aux |grep nginx |grep -q -v grep
#PROCESS_1_STATUS=$?
#ps aux |grep crond |grep -q -v grep
#PROCESS_2_STATUS=$?
## If the greps above find anything, they will exit with 0 status
## If they are not both 0, then something is wrong
#if [ $PROCESS_1_STATUS -ne 0 -o $PROCESS_2_STATUS -ne 0 ]; then
# echo "One of the processes has already exited."
# exit -1
#fi
sleep 60
done