-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswift.kludge
86 lines (73 loc) · 2.94 KB
/
swift.kludge
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
# email settings stored here
if [ -f /root/cpaneldirect/swift.email ]; then
. /root/cpaneldirect/swift.email
fi
# freebsd
if [ -e /etc/master.passwd ]; then
if [ ! -e /usr/local/bin/gstat -a ! -e /usr/local/bin/gnustat ]; then
echo "FreeBSD detected, install coreutils misc/findutils databases/sqlite3 and curl";
exit;
fi
if [ -f /usr/local/bin/gstat ]; then
stat="/usr/local/bin/gstat";
elif [ -e /usr/local/bin/gnustat ]; then
stat="/usr/local/bin/gnustat";
else
echo "Can not find coreutils / stat at $LINENO";
exit;
fi
md5prog="/sbin/md5";
curl="/usr/local/bin/curl";
sqlite="/usr/local/bin/sqlite3";
splitprog="/usr/local/bin/gsplit";
gzip="/usr/bin/gzip";
tar="/usr/bin/tar";
fi
# curl
# -v is *NOT* needed , -i would be better than for headers anyways, i kept -v on the lines that need it
# test with out -v further remove progress-bar unless debug mode is on
if [ "$ignoressl" = "1" ]; then
# progress bar fills up log files
if [ "$RUN_BY_CRON" = "1" ]; then
#echo 'RUN_BY_CRON is true no progress bar will be shown';
CURLOPTS=" -k --limit-rate ${RATE}";
else
CURLOPTS=" -k --progress-bar --limit-rate ${RATE}";
fi
else
CURLOPTS=" --progress-bar --limit-rate ${RATE}";
fi
# os specific centos5 is not eol and can be removed soon
if [ -e /etc/debian_version ]; then
if [ ! -x /usr/bin/sqlite3 ]; then
echo 'Installing sqlite3';
apt-get -y install sqlite3
fi
fi
# centos5 is finally EOL, we can remote this soon
if [ -d /usr/share/doc/centos-release-5 -o `uname -r | cut -d- -f1` = "2.6.18" ]; then
splitprog="$my_path/include/split5";
fi
# for backup system (interserver specific)
if [ -x /opt/curl/bin/curl ]; then
if [ -d /usr/share/doc/centos-release-5 -o `uname -r | cut -d- -f1` = "2.6.18" ]; then
curl="/opt/curl/bin/curl";
fi
fi
# we can test for pigz in standard locations
if [ -x "$my_path/include/pigz" ]; then
arch=`uname -m`;
if [ "$arch" = "x86_64" ]; then
#echo "Using new split and pigz";
#splitprog="/root/cpaneldirect/split";
gzip="$my_path/include/pigz";
fi
fi
function send_email_error()
{
#export ERROR_NOTICE='What is in the email';
#export ERROR_SUBJECT='subject';
#export HOSTNAME=`hostname`;
echo "${ERROR_NOTICE}" | ${MAILX_PATH} -s "${ERROR_SUBJECT} ${HOSTNAME}" -S smtp=${smtpserver} -S smtp-auth=login -S smtp-auth-user=${smtplogin} -S smtp-auth-password=${smtppassword} -S from="${smtpfrom}" -S ssl-verify=ignore -S nss-config-dir=/etc/pki/nssdb $errorsto
#echo "Error email sent content ${ERROR_NOTICE} subject ${ERROR_SUBJECT} {HOSTNAME} smtpserver ${smtpserver} login ${smtplogin} from ${smtpfrom} to $errorsto";
}