-
Notifications
You must be signed in to change notification settings - Fork 3
/
modx.sh
executable file
·153 lines (122 loc) · 3.42 KB
/
modx.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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash
#ïðîâåðêà ñàéòîâ ïî ñïèñêó
clear # Î÷èñòêà ýêðàíà
PATH="/bin:/usr/bin:/usr/local/bin:/usr/local/ssl/bin:/usr/sfw/bin:/usr/local/sbin:/1install:/1install/lib" ; export PATH
MYPATH="/1install"
if [ "$USER" != "root" -a "$USER" != "rust" -a "$USER" != "albert" ]; then
echo ">>>>>>>NO root. Exit<<<<<<" $CHEK
exit 1
fi
# Who to page when an expired domain is detected (cmdline: -e)
ADMIN="[email protected],[email protected]"
#SERVERFILE='/1install/tmp/list/admin.list'
# Don't send emails by default
ALARM="TRUE"
##########################################
# Purpose: Describe how the script works
# Arguments:
# None
##########################################
usage()
{
tput rev
echo "CMF MODX Evo autoinstall with ISPmanager panel"
tput sgr0
echo "-------------------------------------------------------------"
echo "Usage: $0 {[ -a add ] || [ -u update ] || [ -c create ]}"
echo " {[ -d domain_namee ]} || { -f domainfile}"
echo " [ -h ] [ -e email ] [ -a ]"
echo ""
echo " -a add : Add new modx install"
echo " -u update : Update exist modx"
echo " -c create : Create new ISPmanager user, www-domain, and install new modx"
echo ""
echo " -d : "
echo " -f domain file : File with a list of domains"
echo ""
echo " -a : Dont send a final message through email "
echo " -e email address : Email address to send expiration notices"
echo " -h : Print this screen"
echo ""
echo "Example: modx -a 3dstr.ru "
echo ""
}
##########################################
MODX_ADD()
{
echo Domain: "${DOMAIN}"
source modx_add_pevm.sh
}
##########################################
MODX_UPDATE()
{
echo Domain: "${DOMAIN}"
source modx_update.sh
}
##########################################
MODX_CREATE()
{
source isp_create_user.sh
}
##########################################
MODX_MASSADD()
{
while read DOMAIN
do
echo Domain: "CREATE FOR - ${DOMAIN} ---------------"
source modx_add_pevm.sh
done < ${SERVERFILE}
}
##############color for status bar############################
STATUS()
{
red=$(tput setf 4)
green=$(tput setf 2)
reset=$(tput sgr0)
toend=$(tput hpa $(tput cols))$(tput cub 6)
if [ $? -eq 0 ]; then
echo -n "${green}${toend}[OK]"
else
echo -n "${red}${toend}[fail]"
fi
echo -n "${reset}"
echo
}
### Evaluate the options passed on the command line
while getopts ze:f:d:u:a:c option
do
case "${option}"
in
a) DOMAIN=${OPTARG}; MODX_ADD;;
u) DOMAIN=${OPTARG}; MODX_UPDATE;;
c) DOMAIN=${OPTARG}; MODX_CREATE;;
d) DOMAIN=${OPTARG};;
f) SERVERFILE=${OPTARG};MODX_MASSADD;;
e) ADMIN=${OPTARG};;
z) ALARM="FALSE";;
\?) usage
exit 1;;
esac
done
if [ "${DOMAIN}" != "" ]
then
echo "${DOMAIN}"
echo "$ISP_USER"
elif [ -f "${SERVERFILE}" ]
then
while read DOMAIN
do
echo Domain: "${DOMAIN}"
done < ${SERVERFILE}
### There was an error, so print a detailed usage message and exit
else
usage
exit 1;
fi
#if [ "${ALARM}" = "TRUE" ]
#then
#echo "The domain ${DOMAIN} has expired!" \ #| mailx -s "Domain ${DOMAIN} has expired!" ${ADMIN}
#fi
# Add an extra newline
### Exit with a success indicator
exit 0