-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwpma
executable file
·110 lines (92 loc) · 2.03 KB
/
wpma
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
if [[ $# == 0 || $1 == "help" || $1 == "--help" ]]
then
echo "Usage: "
echo " $0 install|update|scan|renew-certs|delete [arguments]"
echo ""
echo "See $0 COMMAND help for info on each subcommand."
echo ""
exit 1
fi
operation_class=$1
wpma_folder=/usr/local/share/wp-mass-admin
case $operation_class in
install)
if [[ $# != 3 || $2 == "help" ]]
then
echo "Usage: "
echo " $0 install USERNAME FQDN"
echo ""
exit 2
fi
if [[ $(whoami) != "root" ]]
then
echo "Install needs to run as root!"
exit 5
fi
user_name=$2
fqdn=$3
"$wpma_folder/install/wp-site" "$user_name" "$fqdn"
;;
update)
if [[ $# != 1 || $2 == "help" ]]
then
echo "Usage: "
echo " $0 update"
echo ""
exit 3
fi
if [[ $(whoami) != "root" ]]
then
echo "Update needs to run as root!"
exit 5
fi
"$wpma_folder/update/wp-site"
;;
scan)
if [[ $# != 1 || $2 == "help" ]]
then
echo "Usage: "
echo " $0 scan"
echo ""
exit 4
fi
if [[ $(whoami) == "root" ]]
then
echo "No need to run scan as root!"
exit 6
fi
"$wpma_folder/scan/wp-site"
;;
delete)
if [[ $# != 3 || $2 == "help" ]]
then
echo "Usage: "
echo " $0 delete USERNAME FQDN"
echo ""
exit 2
fi
if [[ $(whoami) != "root" ]]
then
echo "Delete needs to run as root!"
exit 5
fi
user_name=$2
fqdn=$3
"$wpma_folder/delete/wp-site" "$user_name" "$fqdn"
;;
renew-certs)
if [[ $# != 1 || $2 == "help" ]]
then
echo "Usage: "
echo " $0 renew-certs"
echo ""
exit 6
fi
if [[ $(whoami) != "root" ]]
then
echo "Cert renewal needs to run as root!"
exit 5
fi
"$wpma_folder"/update/renew-https-certificates
esac