File tree Expand file tree Collapse file tree 2 files changed +186
-354
lines changed
Expand file tree Collapse file tree 2 files changed +186
-354
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,32 @@ source $VESTA/conf/vesta.conf
3131A4=' ******'
3232EVENT=" $DATE $TIME $SCRIPT $A1 $A2 $A3 $A4 $A5 $A6 $A7 $A8 $A9 "
3333
34+ is_mysql_host_alive () {
35+ mycnf=$( mktemp)
36+ echo " [client]" > $mycnf
37+ echo " host='$HOST '" >> $mycnf
38+ echo " user='$USER '" >> $mycnf
39+ echo " password='$PASSWORD '" >> $mycnf
40+ chmod 600 $mycnf
41+ mysql --defaults-file=$mycnf -e ' SELECT VERSION()' > /dev/null 2>&1
42+ rm $mycnf
43+ if [ ' 0' -ne " $? " ]; then
44+ echo " Error: MySQL connection to $host failed"
45+ log_event " $E_CONNECT " " $EVENT "
46+ exit $E_CONNECT
47+ fi
48+ }
49+
50+ is_pgsql_host_alive () {
51+ export PGPASSWORD=" $dbpass "
52+ psql -h $host -U $dbuser -c " SELECT VERSION()" > /dev/null 2>&1
53+ if [ ' 0' -ne " $? " ]; then
54+ echo " Error: PostgreSQL connection to $host failed"
55+ log_event " $E_CONNECT " " $EVENT "
56+ exit $E_CONNECT
57+ fi
58+ }
59+
3460
3561# ----------------------------------------------------------#
3662# Verifications #
You can’t perform that action at this time.
0 commit comments