forked from zephyr-y/94imm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
52 lines (47 loc) · 848 Bytes
/
start.sh
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
49
50
51
52
#!/bin/sh
NAME="uwsgi"
function run_start(){
uwsgi --ini uwsgi.ini
}
function run_stop(){
if [ ! -n "$NAME" ];then
echo "no arguments"
exit;
fi
ID=`ps -ef | grep "$NAME" | grep -v "$0" | grep -v "grep" | awk '{print $2}'`
for id in $ID
do
kill -9 $id
done
}
function run_clear(){
rm -rf cache/*
}
case "$1" in "start"|"s"|"S")
run_start
echo "website run successfully"
;;
"restart"|"r"|"S")
run_stop
run_clear
run_start
echo "website restart successfully"
;;
"clear"|"c"|"C")
run_clear
echo "cache cleared"
;;
"stop")
run_stop
echo "website closed"
;;
"post")
read -p "Number of post: " num
cd crawler
post=`python3 AutoPost.py "$num"`
echo $post
;;
*)
echo -e "Use command to:\n-s start website\n-r restart website\n-c clear cache\n-stop stop website\n-post Post an image collection"
;;
esac