Archive

Posts Tagged ‘linux’

How to install MySQL 10.0.6-MariaDB and to compile lib_mysqludf_preg on CentOS 6.4

December 18, 2013 Leave a comment

In short, during an optimization or a MySQL query involving a lot of replace(replace(replace…))) I decided to compile PREG as lib_mysqludf_preg from UDF Repository for MySQL in a view to use PCRE functions directly in MySQL.

Too bad MySQL still cant not use functions for index creation, but this is not the theme of this post.

So, fist install MariaDB 10.0.6:
set the MariaDB 10.0.6 repo, I used the ftp mirror at ftp.ulak.net.tr


root@seik-centos-01:[Wed Dec 18 23:55:12][/tmp]$ cat /etc/yum.repos.d/MariaDB.repo 
# MariaDB 10.0 CentOS repository list - created 2013-12-18 18:07 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
#baseurl = http://yum.mariadb.org/10.0/centos6-amd64
baseurl = ftp://ftp.ulak.net.tr/pub/MariaDB/mariadb-10.0.6/yum/centos6-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
root@seik-centos-01:[Wed Dec 18 23:56:39][/tmp]$ yum repolist | grep -i maria
mariadb          MariaDB                                                      10
root@seik-centos-01:[Wed Dec 18 19:25:49[/tmp]$ yum install MariaDB-server MariaDB-client MariaDB-cassandra-engine  MariaDB-devel MariaDB-shared -y
root@seik-centos-01:[Wed Dec 18 19:31:26][/etc/yum.repos.d]$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")
root@seik-centos-01:[Wed Dec 18 19:32:13][/etc/yum.repos.d]$ service mysql 
Usage: mysql  {start|stop|restart|reload|force-reload|status|configtest}  [ MySQL server options ]
root@seik-centos-01:[Wed Dec 18 19:32:18][/etc/yum.repos.d]$ service mysql  configtest
Testing MySQL configuration syntax SUCCESS! Syntax OK
root@seik-centos-01:[Wed Dec 18 19:32:26][/etc/yum.repos.d]$ service mysql start 
Starting MySQL. SUCCESS! 
root@seik-centos-01:[Wed Dec 18 19:32:32][/etc/yum.repos.d]$ service mysql status
 SUCCESS! MySQL running (1636)
root@seik-centos-01:[Wed Dec 18 19:32:37][/etc/yum.repos.d]$ mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.0.6-MariaDB MariaDB Server

How to compile lib_mysqludf_preg:


root@seik-centos-01:[Wed Dec 18 21:08:50]$ yum install git -y
root@seik-centos-01:[Wed Dec 18 21:09:12]$ mkdir -p /opt/installs
root@seik-centos-01:[Wed Dec 18 21:09:14]$ cd /opt/installs
root@seik-centos-01:[Wed Dec 18 21:10:50][/opt/installs]$ git clone https://github.com/mysqludf/lib_mysqludf_preg.git
Initialized empty Git repository in /opt/installs/lib_mysqludf_preg/.git/
remote: Counting objects: 296, done.
remote: Compressing objects: 100% (139/139), done.
remote: Total 296 (delta 192), reused 256 (delta 155)
Receiving objects: 100% (296/296), 504.10 KiB | 311 KiB/s, done.
Resolving deltas: 100% (192/192), done.
root@seik-centos-01:[Wed Dec 18 21:11:20][/opt/installs]$ cd lib_mysqludf_preg/

In case on configure you get error: no acceptable C compiler found, you have to set up the development environment

root@seik-centos-01:[Wed Dec 18 21:11:53][/opt/installs/lib_mysqludf_preg]$ ./configure 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for style of include used by make... GNU
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/opt/installs/lib_mysqludf_preg':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
root@seik-centos-01:[Wed Dec 18 21:12:12][/opt/installs/lib_mysqludf_preg]$ yum groupinstall Development tools -y

If you get an error: “Can’t find libpcre” , you need to install the pcre dev libs

root@seik-centos-01:[Wed Dec 18 21:23:15][/opt/installs/lib_mysqludf_preg]$ ./configure 
.....
configure: setting libdir to mysql plugin dir /usr/lib64/mysql/plugin
checking for pcre-config... no
checking for PCRE - version >= 1... no
configure: error: "Can't find libpcre"
root@seik-centos-01:[Wed Dec 18 21:28:04][/opt/installs/lib_mysqludf_preg]$ yum install pcre-devel

If after the configure on make you get this WARNING: ‘aclocal-1.13’ is missing on your system

root@seik-centos-01:[Wed Dec 18 21:28:57][/opt/installs/lib_mysqludf_preg]$ make 
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /opt/installs/lib_mysqludf_preg/config/missing aclocal-1.13 
/opt/installs/lib_mysqludf_preg/config/missing: line 81: aclocal-1.13: command not found
WARNING: 'aclocal-1.13' is missing on your system.
         You should only need it if you modified 'acinclude.m4' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'aclocal' program is part of the GNU Automake package:

         It also requires GNU Autoconf, GNU m4 and Perl in order to run:

make: *** [aclocal.m4] Error 127

The most easy way to fix this is to execute this:
aclocal && libtoolize –force && autoreconf

root@seik-centos-01:[Wed Dec 18 21:52:42][/opt/installs/lib_mysqludf_preg]$  aclocal && libtoolize --force && autoreconf
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `config'.
libtoolize: linking file `config/ltmain.sh'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
test/Makefile.am:13: wildcard *.test: non-POSIX variable name
test/Makefile.am:13: (probably a GNU make extension)
test/Makefile.am:22: `%'-style pattern rules are a GNU make extension
test/Makefile.am:25: `%'-style pattern rules are a GNU make extension

then again execute ./configure && make

root@seik-centos-01:[Wed Dec 18 21:52:55][/opt/installs/lib_mysqludf_preg]$ ./configure  
....
checking for pthread_getattr_np declaration... missing
configure: creating ./config.status
config.status: creating Makefile
config.status: creating test/Makefile
config.status: creating doc/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
root@seik-centos-01:[Wed Dec 18 21:53:05][/opt/installs/lib_mysqludf_preg]$ make -d
----
Must remake target `all-am'.
Successfully remade target file `all-am'.
make[2]: Leaving directory `/opt/installs/lib_mysqludf_preg'
Reaping winning child 0x0183f9f0 PID 3130 
Removing child 0x0183f9f0 PID 3130 from chain.
Successfully remade target file `all-recursive'.
make[1]: Leaving directory `/opt/installs/lib_mysqludf_preg'
Reaping winning child 0x01955110 PID 3129 
Removing child 0x01955110 PID 3129 from chain.
Successfully remade target file `all'.
root@seik-centos-01:[Wed Dec 18 21:53:13][/opt/installs/lib_mysqludf_preg]$ make install
root@seik-centos-01:[Wed Dec 18 22:03:05][/opt/installs/lib_mysqludf_preg]$ make installdb
/usr/bin/mysql  <./uninstalldb.sql
cat installdb.sql | sed 's/\.so/.dll/g' >installdb_win.sql
if test -f .libs/lib_mysqludf_preg.dll; then  \
		/usr/bin/mysql  <./installdb_win.sql; \
	else \
		/usr/bin/mysql  <./installdb.sql;\
	fi
root@seik-centos-01:[Wed Dec 18 22:03:19][/opt/installs/lib_mysqludf_preg]$ 

How to test the PCRE with MySQL MariaDB 10.0.6:

mysql root@seik-centos-01:[Thu Dec 19 00:09:27 2013][(none)]> SELECT CONVERT( PREG_REPLACE( '/fox/i' , 'dog' , 'The brown fox' ) USING UTF8) as replaced;
+---------------+
| replaced      |
+---------------+
| The brown dog |
+---------------+
1 row in set (0.00 sec)

and you are done

Slackware4Life 🙂

Advertisements
Categories: CentOS, MariaDB, MySQL Tags: , , , , ,

oneliner how to clear store of particular old MO/DLR messages of Kannel bearerbox version `svn-r5011M’.

February 10, 2013 Leave a comment

We assume the kannel stora is spooled at /var/log/kannel/kannel.spool/
How to clean the old non sent/routed MO messages from 1st to 9th Feb 2013


root@darkstar:[Sun Feb 10 17:28:56]:[~/bin]$ curl -s "http://127.0.0.1:13000/store-status.txt?username=xxxxx&password=xxxx" | awk '$2~/\[MO\]/{print $0};$3~/\[2013-02-0/{ gsub(/[\[\]]/,"",$1);print $1}'  | xargs --no-run-if-empty -icrap find /var/log/kannel/kannel.spool/ -type f -name crap -exec rm -f {} \;

serice kannel restart

Categories: bash, CentOS, Kannel, Linux, Slackware Tags: , , , , ,

MySQL Cluster mysql-5.5.22 ndb-7.2.6 on Linux RHEL 6.3 (Santiago) : restore backup script

February 4, 2013 Leave a comment

Latest update : restore has been done with the exception of the full MySQL cluster restore – I need to do more tests here.
Some code clean up to be done as well , so is someone is in interested check the git from now on.

Update – migrated to bitbucket: https://bitbucket.org/seikath/epg-mysql-cluster , still under development

After digging for more detailed info whats the proper execution of the MySQL cluster restore procedure , I came up with that script:

Note, the real restore is deactivated here and there is one “s” added to the ndb_* commands in a view to avoid any fuckups with the PROD ENV where I wrote it

The script has been tested at the DEV ENV with some small changes

Second note: due to security restrictions I decided to execute the restore from one of the data nodes, in a view to save some extra scripting.

#!/bin/sh
# epgbcn4 aka seikath@gmail.com
# is410@epg-mysql-memo1:~/bin/epg.mysql.cluster.restore.sh
# moved to bitbucket : 2013-02-06.15.26.48
# 2013-02-17.03.14.12
# 2013-02-17.14.07.09 - add backup data maintenance feature 
# So far on RHEL .. porting to other distors after its done for RHEL 

SCRIPT_NAME=${0%.*}
LOG_FILE="$(basename ${SCRIPT_NAME}).$(date +%Y-%m-%d.%H.%M.%S).log"
CONF_FILE=${SCRIPT_NAME}.conf
TMP_WORL_FILE="/tmp/${HOSTNAME}.$(basename ${SCRIPT_NAME}).tmp"

# Loading configuraion 
if [ -f "${CONF_FILE}" ]
then
        source "${CONF_FILE}"
else 
        logit "Missing config file ${CONF_FILE} !  Exiting now."
        exit 0
fi
# activating debug 
test $DEBUG -eq 1 && set -x

# initialize the tmp file 
test `echo "" >  "${TMP_WORL_FILE}"` && logit "${TMP_WORL_FILE} initialized!"

function logit () {
    echo "$(date)::[${HOSTNAME}] : ${1}"
    echo "$(date)::[${HOSTNAME}] : ${1}" >> "${LOG_FILE}"
}

# getting the user ID, check sudo, ndbd restart command 
check_is_root=$(id | sed '/^uid=0/!d' | wc -l)
user_name=$(id -nu)

local_command_ndbd=$(chkconfig --list| grep ndbd | awk '{print $1}')
command_ndbd="service ${local_command_ndbd} restart-initial"
command_restar_ndbd="sudo ${command_ndbd}"
sudo_status=$(sudo -l | tr '\n|\r' ' ' | sed 's/^.*User /User /;s/  */ /g' | grep -i "${user_name}")
no_passwd_check=0
test `echo ${sudo_status} | grep "(ALL) NOPASSWD: ALL" | wc -l ` -gt 0  && no_passwd_check=1
test $check_is_root -eq 1 && command_restar_ndbd="${command_ndbd}"




if [ ${no_passwd_check} -eq 1 ]
then 
        add_sudo="sudo ";
else 
        add_sudo="";
fi 

# check initial credential 
logit "UID check : ${user_name}"
logit "Sudo check : ${sudo_status}"
test ${no_passwd_check} -eq 1 && logit "No Passwd sudo check : Confirmed!"
test ${no_passwd_check} -eq 0 && logit "No Passwd sudo check : NOTE -> Missing passwordless sudo!"
#logit "Got ndbd sercice restart command to be run by user ${user_name} : ${command_restar_ndbd}"

# get the available active IPs:
local_ip_array=$(${add_sudo}ifconfig  | grep "inet addr:" | grep -v grep | awk '{print $2}' | sed 's/^addr://')

# get the ndbd data 
data=$(${add_sudo}ndb_config -c ${ndb_mgmd[1]},${ndb_mgmd[2]} --type=ndbd --query=id,host,datadir -f ' ' -r '\n') 

# get the recent data node ID, its IP and the data directory used
# check the ndbd start-stop command name of all ndbd data nodes
echo "${data}" | \
while read nodeID  nodeIP backupDir
do      
        logit "Getting the ndbd start script name from ${user_name}@${nodeIP}"
        command_ndbd[${nodeID}]=$(echo "${add_sudo}/sbin/chkconfig --list" | ${ssh_command} ${user_name}@${nodeIP}  | grep ndb | awk '{print $1}')
        localHit=0;
        for IP in ${local_ip_array}
        do
                test "${nodeIP}" == "${IP}" && localHit=1 && break;
        done  
        echo -e "${nodeIP}\t${nodeID}\t${backupDir}${LocalBackupDirName}\t${command_ndbd[${nodeID}]}\t${localHit}" >> "${TMP_WORL_FILE}"
done

# load the the recent data node ID, its IP and the data directory used
if [ -f "${TMP_WORL_FILE}" ]
then 
        ndbd_cntr=0;
        while read tmp_IP tmp_nodeID tmp_backupDir tmp_command_ndbd tmp_localHit
        do
                test -z ${tmp_localHit} && continue;
                if [ ${tmp_localHit} -eq 1 ] 
                then
                        IP="${tmp_IP}";
                        nodeID="${tmp_nodeID}";
                        backupDir="${tmp_backupDir}"
                        
                fi 
                command_ndbd[${nodeID}]="${tmp_command_ndbd}";
                ndbd_data_node_id[$ndbd_cntr]="${tmp_nodeID}";
                ndbd_data_IP[$ndbd_cntr]="${tmp_IP}";
                ndbd_data_bckp_dir[$ndbd_cntr]="${tmp_backupDir}";
                ndbd_data_cmd[$ndbd_cntr]="${tmp_command_ndbd}";
                ndbd_data_local[$ndbd_cntr]=${tmp_localHit};
                ((++ndbd_cntr))
        done < "${TMP_WORL_FILE}"
else
        logit "Missing data collection at ${TMP_WORL_FILE}. Exiting no." && exit 0;     
fi

logit "got Local machine IP ${IP}";
logit "got Local machine MySQL cluster nodeID : ${nodeID}";
logit "got MySQL cluster local backup Dir : ${backupDir}";
logit "got MySQL cluster RHEL local service command : ${local_command_ndbd}";

# choose other backup available
while [ 1  ]
do 
        read  -r -p "$(date)::[${HOSTNAME}] : Do you want to choose ANOTHER backup forder : Yes/No [y/n] : "  choice
        if [ "$choice" != "" ]
        then
                case $choice in
                "Yes" | "yes" | "y" | "Si" | "si" | "Y")
                while [ 1  ]
                do 
                        read  -r -p "$(date)::[${HOSTNAME}] : Please provide the full name of the PARENT backup forder or hit CTRL+C to terminate...: "  chosenDIR
                        if [ -d "${chosenDIR}" ]
                        then
                                echo "";
                                backupDir="${chosenDIR}"
                                break 2;
                        else 
                                logit "We can not find the PARENT backup forder of ${chosenDIR}"
                                echo ""
                        fi
                done
                ;; 
                "No" | "n" | "N" )
                logit "Proceeding with the condifured nightly backup.."
                break;
                ;;
                *)
                logit "Empty imput, please provide the full name of the backup forder or hit CTRL+C to terminate:"
                ;;
                esac
        fi
done

# check read permissions at backupDir
add_sudo="";
logit "Cheking the read permissions of ${backupDir}.."
if [ ! -r "${backupDir}" ]
then 
        logit "User ${user_name} can not read the backup directory of ${backupDir}!";
        logit "Switching to sudo .."
        if [ ${no_passwd_check} -eq 0 ]
        then 
                logit "User ${user_name} can not read the backup directory of ${backupDir} with sudo neither!";
                exit 0;
        else 
                add_sudo="sudo "
        fi 
fi 

# check the content of the backup directory provided 
logit "DEBUG : check the content of the backup directory provided [${backupDir}]"
if [ -d "${backupDir}" ]
then
        ${add_sudo}ls -1rt "${backupDir}/" |  while read crap; do logit "Found possible local backup of ndb_mgmd id ${nodeID}::${IP} : [$crap]";done
fi

while [ 1  ]
do 
        read  -r -p "$(date)::[${HOSTNAME}] : Please choose local backup to restore or hit CTRL+C to terminate...:  "  paused
        if [ "$paused" != ""  -a -d "${backupDir}/${paused}" ]
        then
                paused=${paused%%/}
                NDB_BACKUP_NUMBER=${paused/*-/}
                NDB_BACKUP_DIR="${backupDir}/${paused}"
                NDB_BACKUP_LOG="${backupDir}/${paused}/${paused}.${nodeID}.log"
                break;
        else 
                echo ""
        fi
done


# check sudo availability 
add_sudo="";
logit "Cheking the read permissions of ${NDB_BACKUP_DIR}.."
if [ ! -r "${NDB_BACKUP_DIR}" ]
then 
        logit "User ${user_name} can not read the backup directory of ${NDB_BACKUP_DIR}!";
        logit "Switching to sudo .."
        if [ ${no_passwd_check} -eq 0 ]
        then 
                logit "User ${user_name} is missing sudo and can not read the backup directory of ${NDB_BACKUP_DIR}!";
                exit 0;
        else 
                add_sudo="sudo ";
        fi 
fi 

# check if there is backup log file in the backup directory 
logit "Cheking the read permissions of ${NDB_BACKUP_LOG}.."
${add_sudo}ls ${NDB_BACKUP_LOG}  >> /dev/null 2>&1
test $? -gt 1 && logit "Error : ${NDB_BACKUP_LOG} is missing at ${NDB_BACKUP_DIR} ! Exiting now." && exit 0;

# checking the backup consistency:
if [ -d "${NDB_BACKUP_DIR}" ]
then
        logit "We are about to proceed with the restore of the backup at ${NDB_BACKUP_DIR}:  $(${add_sudo}ls -lrth ${NDB_BACKUP_DIR})"
        logit "Checking the backup consistency:"
        NDB_BACKUP_STATUS=$(${add_sudo}ndb_print_backup_file "${NDB_BACKUP_LOG}")
        test `echo ${NDB_BACKUP_STATUS}  | grep -i "NDBBCKUP" | wc -l ` -eq 0 && logit "${NDB_BACKUP_LOG} is NOT NDB consistane Backup file!" && exit 0
        # echo "${NDB_BACKUP_STATUS}"
        logit "Confirmed : ${NDB_BACKUP_DIR} contains consistent backup"
else 
        logit "ERROR : Missing NDB BACKUP directory ${NDB_BACKUP_DIR}!"
fi

#  choose the restore type: full restore with drop database or table restore
logit "Starting the restore type questionaire: "

restoreStringInclude="";
while [ 1  ]
do 
        read  -r -p "$(date)::[${HOSTNAME}] : Please choose the restore type : FULL MySQL cluster [F], DATABASE [D] or TABLE [T] to restore OR hit CTRL+C to terminate : "  restore
        if [ "$restore" != "" ]
        then
                case $restore in
                "F" | "f" | "FULL" | "Full" )
                restoreStringInclude="-m"; # restore MySQL cluster table metadata 
                logit "Proceeding with the FULL MySQL BACKUP restore.";
                break;
                ;; 
                "D" | "d" | "Database" | "DATABASE" )
                logit "Make sure the database is existing, otherwise the restore will fail and you would need full MySQL initialization restore"
                # add here check of the MySQL cluster data nodes status 
                logit "Fetching the databases from the MySQL cluster ... "
                # Fetch the databases from the MySQL Cluster : 
                data_ndb_databases_online=$(${add_sudo}ndb_show_tables -c ${ndb_mgmd[1]},${ndb_mgmd[2]} -t 2 | awk '$1 ~ /^[[:digit:]]/ && $2 == "UserTable" && $3 == "Online"  {print $5}' | sort | uniq)
                cntr=0;
                for DbName in ${data_ndb_databases_online}
                do 
                        ((++cntr));
                        dbArrayName[${cntr}]="${DbName}";
                        comma=" => ";
                        test $cntr -gt 9 &&  comma=" : "
                        logit "Found database${comma}[${DbName}]";
                        lastdbArrayName="${DbName}";
                done

                # Get the users Database choice
                while [ 1  ]
                do 
                        logit "You may provide a comma separated list of databases to restore.";
                        test ${#dbArrayName[@]} -gt 1 && logit "Example: ${dbArrayName[1]},${lastdbArrayName}";
                        test ${#dbArrayName[@]} -eq 1 && logit "Example: ${dbArrayName[1]}";
                        read  -r -p "$(date)::[${HOSTNAME}] : Please provide the DATABASE NAMES OR hit CTRL+C to terminate : "  userDbNames;
                        if [ "${userDbNames}" != "" ]
                        then
                                # Read the user choices
                                IFS=', ' read -a ArrayUserDbNames <<< "${userDbNames}"
                                # checking the user data consistency
                                logit "Checking the databases.."
                                DbNameOnly_restrore_string="";
                                for idx in "${!ArrayUserDbNames[@]}"
                                do
                                        crap[$idx]=1;

                                        for DbNameOnly  in ${data_ndb_databases_online}
                                        do
                                                if [ "${ArrayUserDbNames[idx]}" == "${DbNameOnly}" ]
                                                then 
                                                        commat="";
                                                        test "${DbNameOnly_restrore_string}" != "" && commat=",";
                                                        crap[$idx]=0;
                                                        logit "[${ArrayUserDbNames[idx]}] : Confirmed";
                                                        break;
                                                fi
                                        done
                                        DbNameOnly_restrore_string="${DbNameOnly_restrore_string}${commat}${ArrayUserDbNames[idx]}";
                                        test ${crap[idx]} -eq 1 \
                                        && logit "Note : the database ${ArrayUserDbNames[idx]} is missing in the curent MySQL Cluster!" \
                                        && logit "We recommend restore witj DDL/metadata" \
                                        && logit "After a successfull restore of a MISSING database you HAVE TO CREATE IT by \"mysql> create database ${ArrayUserDbNames[idx]};\"" \
                                        && logit "Then all the restored tables and data will be accessible.";
                                                                                
                                done
                                # check if the DDL should be restored as well :
                                while [ 1  ]
                                do
                                        read  -r -p "$(date)::[${HOSTNAME}] : Do you want the table metadata to be restored as well? Y/N : "  restoreDDL;
                                        if [ "${restoreDDL}" != "" ]
                                        then
                                                case ${restoreDDL} in
                                                "Y" | "y" | "yes" | "Yes" | "YES" )
                                                logit "Including the DDLL/meta table data restore";
                                                restoreStringInclude="-m --include-databases=${DbNameOnly_restrore_string}";
                                                break;
                                                ;;
                                                "N" | "n" | "No" | "NO" | "Non" )
                                                logit "Skipping the DDL/meta table data restore";
                                                restoreStringInclude="--include-databases=${DbNameOnly_restrore_string}";
                                                break;
                                                ;;
                                                *)
                                                logit "Please choose [Y]es or [N]O!"
                                                ;;
                                                esac
                                        fi
                                done 
                                #logit "Proceeding with the BACKUP of the database(s) ${DbNameOnly_restrore_string}"
                                #logit "DEBUG : restoreStringInclude : ${restoreStringInclude}";
                                # restoreStringInclude="--include-databases=${DbNameOnly_restrore_string}";
                                break 2;
                        else 
                                logit "Empry database(s) name to be restored!"
                        fi
                done 

                logit "Proceeding with the FULL DATABASE BACKUP. To be done just like the table backup"
                break;
                ;; 
                "T" | "t" )
                logit "Make sure the database.table is existing, otherwise the restore will fail."
                logit "Fetching the databases and its tables from the MySQL cluster ... "
                # get the database.table list from the mysql cluster
                data_ndb_databases_tables_online=$(${add_sudo}ndb_show_tables -c ${ndb_mgmd[1]},${ndb_mgmd[2]} -t 2 | awk  ' ($1 ~ /^[[:digit:]]/ && $7 !~ /^NDB\$BLOB/) {print $5"."$7}' | sort | uniq)                cntr=0
                # print a list of the db.tables available atm 
                cntr=0;
                for DbNameAndTable  in ${data_ndb_databases_tables_online}
                do 
                        ((++cntr));
                        dbArray[${cntr}]="${DbNameAndTable}";
                        comma="  : ";
                        test $cntr -gt 9 &&  comma=" : "
                        logit "[${cntr}]${comma}[${DbNameAndTable}]";
                        lastdbArray="${DbNameAndTable}";
                done
                # Get the users Database and table choice
                DbNameTable_restrore_string="";
                while [ 1  ]
                do 
                        logit "You may provide a comma separated list of tables to restore.";
                        test ${#dbArray[@]} -gt 1 && logit "Example: ${dbArray[1]},${lastdbArray}";
                        test ${#dbArray[@]} -eq 1 && logit "Example: ${dbArray[1]}";
                        read  -r -p "$(date)::[${HOSTNAME}] : Please provide the full name of the table(s) OR hit CTRL+C to terminate : "  tableName;
                        if [ "${tableName}" != "" ]
                        then
                                # Read the user choices
                                IFS=', *' read -a userTables <<< "${tableName}"
                                # checking the user data consistency
                                logit "Checking the tables.."
                                for idx in "${!userTables[@]}"
                                do
                                        crap[$idx]=1;
                                        for DbNameAndTable  in ${data_ndb_databases_tables_online}
                                        do
                                                if [ "${userTables[idx]}" == "${DbNameAndTable}" ]
                                                then
                                                        commat="";
                                                        test "${DbNameTable_restrore_string}" != "" && commat=",";
                                                        crap[$idx]=0;
                                                        logit "[${userTables[idx]}] : Confirmed";
                                                        break;
                                                fi 
                                        done
                                        DbNameTable_restrore_string="${DbNameTable_restrore_string}${commat}${userTables[idx]}";
                                        test ${crap[idx]} -eq 1 && logit "NOTE : Table ${userTables[idx]} is missing in the curent MySQL Cluster!";
                                done

                                # check if the DDL should be restored as well :
                                while [ 1  ]
                                do
                                        read  -r -p "$(date)::[${HOSTNAME}] : Do you want the table metadata to be restored as well? Y/N : "  restoreDDL;
                                        if [ "${restoreDDL}" != "" ]
                                        then
                                                case ${restoreDDL} in
                                                "Y" | "y" | "yes" | "Yes" | "YES" )
                                                logit "Including the DDLL/meta table data restore";
                                                restoreStringInclude="-m --include-tables=${DbNameTable_restrore_string}";
                                                break;
                                                ;;
                                                "N" | "n" | "No" | "NO" | "Non" )
                                                logit "Skipping the DDL/meta table data restore";
                                                restoreStringInclude="--include-tables=${DbNameTable_restrore_string}";
                                                break;
                                                ;;
                                                *)
                                                logit "Please choose [Y]es or [N]O!"
                                                ;;
                                                esac
                                        fi
                                done 

                                #restoreStringInclude="--include-tables=${DbNameTable_restrore_string}";
                                logit "Proceeding with the BACKUP of the tables ${DbNameTable_restrore_string}"
                                break 2;
                        else 
                                logit "Empry table name to be restored!"
                        fi
                done 
                ;;
                *)
                logit ": Please choose the restore type : FULL DATABASE restore including database [F] or TABLE [T]restore OR hit CTRL+C to terminate... [F(ull)]/[T(able)]:  "
                ;;
                esac
        fi
done

logit "About to execute the restore procedure with the following options : [${restoreStringInclude}]."
# possible stupid question to add : Do you want to proceed ? Y/N [Y]
# checking the available API nodes :
logit "Checking the available API nodes:"
api_data=$(${add_sudo}ndb_mgm --ndb-mgmd-host=${ndb_mgmd[1]},${ndb_mgmd[2]} -e 'show' | sed  '/^\[mysqld(API)\]/,$!d;/^ *$/d')
echo "${api_data}"
#get the first node : 
echo "${api_data}" | sed  '/^\[mysqld(API)\]/d' | \
while read  API_NODE_ID API_NODE_IP crap
do
        API_NODE_ID=${API_NODE_ID/*=/}
        test `echo "${crap}" | grep "not connected" | wc -l` -gt 0 && logit "Skipping NOT CONNECTED API Node ID [${API_NODE_ID}] ${API_NODE_IP}{$crap}" && continue;
        API_NODE_IP=${API_NODE_IP/@/}
        logit "Procceding MySQL CLuster API NODE [${API_NODE_ID}] at [${API_NODE_IP}]"
        API_NODE_ID=${API_NODE_ID/*=/}
        # set the API node in single user more :
        case $restore in
        "F" | "f" | "FULL" | "Full" )
                # loop again the data nodes 
                logit "The Full MySQL custer restore has been deactivated at that time. The proceeding will be added after extensive testing."
                exit 0;
                ndbd_initial_status=1;
                for idx in $(seq 0 $((${#ndbd_data_node_id[@]} - 1)))
                do
                        ndbd_start_status[$idx]=$(echo "ps aux | grep -v grep | grep -i ndbd | sed '1,1!d'" | ${ssh_command} ${user_name}@${ndbd_data_IP[idx]})
                        if [ "${ndbd_start_status[idx]}" != "" -a "${ndbd_start_status[idx]}" != "${ndbd_start_status[idx]/--initial/}" ]
                        then
                                
                                logit "MySQL Cluster NDB DATA NODE [${ndbd_data_node_id[idx]}] runnig in initial mode, no restart needed";
                        elif [ "${ndbd_start_status[idx]}" == "" ]
                        then
                                ndbd_initial_status=0;
                                logit "MySQL Cluster NDB DATA NODE [${ndbd_data_node_id[idx]}] is runnig in start mode, restart in initial mode is needed.";
                                logit "Executing restart initial at NDBD node [${ndbd_data_node_id[idx]}]";
                        else
                                ndbd_initial_status=0;
                                logit "MySQL Cluster NDB DATA NODE [${ndbd_data_node_id[idx]}] is NOT runnig ";
                        fi 
                        logit "DEBUG: idx: [${idx}] : ${ndbd_start_status[idx]}";
                done
                if [ ${ndbd_initial_status} -eq 1  ]
                then
                        logit "Check MySQL CLuster single user mode status";
                        mysql_sluster_status=$(${add_sudo}ndb_mgm --ndb-mgmd-host=${ndb_mgmd[1]},${ndb_mgmd[2]} -e 'show' | sed '/ndbd/,/^ *$/!d;/^ *$/d;/^id/!d;/single user mode/!d' | wc -l)
                        if [ ${mysql_sluster_status} -eq $((${#ndbd_data_node_id[@]}-1)) ]
                        then
                                logit "Setting the MySQL CLuster DATA NODE [${API_NODE_ID}] at ${API_NODE_IP}] in single user mode";
                                mysql_sluster_set_sinlge_user_mode=$(${add_sudo}ndb_mgm --ndb-mgmd-host=${ndb_mgmd[1]},${ndb_mgmd[2]} -e 'enter single user mode ${API_NODE_ID}');
                        else
                                logit "No need to set the single user mode as its already activated";
                                logit "Executing FULL restore with table metadata."
                                cmd_restore="${add_sudo}ndb_restore -c ${API_NODE_IP}  ${restoreStringInclude} -b ${NDB_BACKUP_NUMBER} -n ${nodeID} -r ${NDB_BACKUP_DIR}"
                                logit "${cmd_restore}"
                                mysql_sluster_restore_result=$(${cmd_restore})
                                echo "${mysql_sluster_restore_result}"


                        fi
                else
                        logit ""
                fi
                exit 0 ;
                logit "ssh -q -nqtt -p22 ${user_name}@${ndbd[1]} '${command_restar_ndbd}' restart-initial"
                logit "DEBUG : have to find the restart command at the other node !"
                logit "ssh -q -nqtt -p22 ${user_name}@${ndbd[2]} '${command_restar_ndbd}' restart-initial"
                logit "Cheking the status of ndbd at  ${ndbd[1]}"
                logit "${ssh_command} ${user_name}@${ndbd[1]} '${command_restar_ndbd} status'"
                ndbd_status[]echo "${command_restar_ndbd} status" | ${ssh_command} ${user_name}@${ndbd[1]}
                logit "Cheking the status of ndbd at  ${ndbd[2]}"
                logit "ssh -q -nqtt -p22 ${user_name}@${ndbd[2]} '${command_restar_ndbd} status'"
                logit "Setting the API node [${API_NODE_ID}] in single user"
                # possible check if the user wants to clean up the mysql cluster DB like executing drop database ... create database
                logit "${add_sudo}ndb_mgms --ndb-mgmd-host=${ndb_mgmd[1]},${ndb_mgmd[2]} -e 'enter single user mode ${API_NODE_ID}'" 
                status=$(${add_sudo}ndb_mgm --ndb-mgmd-host=${ndb_mgmd[1]},${ndb_mgmd[2]} -e 'show' | grep "^id={$nodeID}" | grep "@${IP}")
                logit "Cluster status of ndbd id ${nodeID} : ${status}"
                logit "${add_sudo}ndb_restores  -c ${API_NODE_IP}  ${restoreStringInclude} -b ${NDB_BACKUP_NUMBER} -n ${nodeID} -r ${NDB_BACKUP_DIR}"
                logit "Exiting the single user more:"
                logit "${add_sudo}ndb_mgms --ndb-mgmd-host=${ndb_mgmd[1]},${ndb_mgmd[2]} -e 'exit single user mode'"
        ;;
        "D" | "d" | "Database" | "DATABASE" )
                logit "Starting the restore process for databases(s) ${DbNameOnly_restrore_string}, please wait a bit .. "
                restore_result=$(${add_sudo}ndb_restore  -c ${API_NODE_IP}  ${restoreStringInclude} -b ${NDB_BACKUP_NUMBER} -n ${nodeID} -r "${NDB_BACKUP_DIR}" 2>&1 | tee -a "${LOG_FILE}")
                what_to_see=$(echo ${restore_result} | sed '/^Processing data in table/d')
                if [ "${what_to_see}" != "${what_to_see/NDBT_ProgramExit: 0 - OK/}" ]
                then 
                        logit "The restore was successful! detailed log at ${LOG_FILE} ."
                        logit "Slackware4File!";
                elif [ "${what_to_see}" != "${what_to_see/Unable to find table:/}" ]
                then 
                        logit "The restore FAILED due to missing/broken tables! Detailed log at ${LOG_FILE}"
                        logit "We recommed restore the table metadata of $(echo ${what_to_see} | sed 's/^.*Unable to find table:/Unable to find table:/;s/^Unable to find table: //;s/ .*$//' ) table";
                elif [ "${what_to_see}" != "${what_to_see/Missing column/}" ]
                then
                        logit "The restore FAILED due to missing/broken fields in a table! Detailed log at ${LOG_FILE}";
                        logit "We recommed full full restore with table metadata.";
                elif [ "${what_to_see}" != "${what_to_see/Schema object with given name already exists/}" ]
                then
                        logit "The restore FAILED due to attempt to create an exsisting table! Detailed log at ${LOG_FILE}";
                        logit "We recommed the following steps:";
                        logit "1. Restore without the table metadata OR";
                        logit "2. In case the step fails due to missing tables we reccomend FULL restore with dropping the database";
                else
                        logit "The restore FAILED";
                fi
        ;;
        "T" | "t" )
                logit "Starting the restore process for table(s) ${DbNameTable_restrore_string}, please wait a bit .. "
                restore_result=$(${add_sudo}ndb_restore  -c ${API_NODE_IP}  ${restoreStringInclude} -b ${NDB_BACKUP_NUMBER} -n ${nodeID} -r "${NDB_BACKUP_DIR}" 2>&1 | tee -a "${LOG_FILE}")
                what_to_see=$(echo ${restore_result} | sed '/^Processing data in table/d')
                if [ "${what_to_see}" != "${what_to_see/NDBT_ProgramExit: 0 - OK/}" ]
                then 
                        logit "The restore was successful! detailed log at ${LOG_FILE} ."
                        logit "Slackware4File!";
                elif [ "${what_to_see}" != "${what_to_see/Unable to find table:/}" ]
                then 
                        logit "The restore FAILED due to missing/broken tables! Detailed log at ${LOG_FILE}"
                        logit "We recommed full full restore with table metadata.";
                elif [ "${what_to_see}" != "${what_to_see/Missing column/}" ]
                then
                        logit "The restore FAILED due to missing/broken fields in a table! Detailed log at ${LOG_FILE}";
                        logit "We recommed the following steps:";
                        logit "1. We recommed table restore with DDL/table metadata restore";
                        logit "2. In case the step fails due to existing tables we recomend FULL restore with dropping the database";
                elif [ "${what_to_see}" != "${what_to_see/Schema object with given name already exists/}" ]
                then
                        logit "The restore FAILED due to attempt to create an exsisting table! Detailed log at ${LOG_FILE}";
                        logit "We recommed the following steps:";
                        logit "1. Restore without the table metadata OR";
                        logit "2. In case the step fails due to missing tables we recomend FULL restore with dropping the database";
                else
                        logit "The restore FAILED";
                fi
        ;;
        *)
                logit "Nothing to do here"
        ;;
        esac
        status=$(${add_sudo}ndb_mgm --ndb-mgmd-host=${ndb_mgmd[1]},${ndb_mgmd[2]} -e 'show' | grep "^id={$nodeID}" | grep "@${IP}")
        logit "Cluster status of ndbd id ${nodeID} : ${status}"
        break; # we execute on the first acive API node
done

and the config file used:

root@darkstar:[Tue Feb 05 00:06:27]:[~/bin]$ cat mysql.cluster.restore.conf 
# epgbcn4 aka seikath@gmail.com
# is410@epg-mysql-memo1:~/bin/epg.mysql.cluster.restore.sh
# 2013-02-17.03.42.08

ndbd[1]=10.95.109.195
ndbd[2]=10.95.109.196

ndb_mgmd[1]=10.95.109.216
ndb_mgmd[2]=10.95.109.217

LocalBackupDirName="backup/BACKUP"

ssh_command="ssh -T -p 22"

DEBUG=1 # active
DEBUG=0 # deactivated 


# add error handling array here for later handling via looping the array
restore_error_match[0]="Unable to find table:"
restore_error_text[0]="The restore FAILED due to missing/broken tables!"

Migrating MySQL 5.5.25a jiradb ERROR 2013 (HY000) on huge single db import

January 18, 2013 Leave a comment

well, I incremented max_allowed_packet from 16M to 512M
anyway, I got the same error on the next clean import.
so decided to find a workaround.
so, how to get the data separated from the ddl statements:

# get the tables names into the insert statement, its better to have that in file for future usage
sed '/^INSERT INTO/!d;s/ VALUES.*$//' jiradb.20130118.sql | sort | uniq > tablas.como.nombres.txt

then how to get the data separated:

root@jiragg:[Fri Jan 18 15:26:33]:[/usr/local/BACKUP]$ cat make.inserts.sh
#!/bin/sh
# trim function thank to http://stackoverflow.com/questions/369758/how-to-trim-whitespace-from-bash-variable
# and http://codesnippets.joyent.com/posts/show/1816
trim() {
    local var=$1
    var="${var#"${var%%[![:space:]]*}"}"   # remove leading whitespace characters
    var="${var%"${var##*[![:space:]]}"}"   # remove trailing whitespace characters
    echo -n "$var"
}

while read tabname
do
        tablename=$(trim $(echo $tabname | sed 's/INSERT INTO//;s/[[:punct:]]*//g'))
        echo "${tabname}:=>${tablename}"
        sed "/^INSERT INTO \`${tablename}\` VALUES/!d" /usr/local/BACKUP/jiradb.20130118.sql | gzip > "/usr/local/BACKUP/${tablename}.jiradb.20130118.sql.gz"
done < tablas.como.nombres.txt

how to get the DDLs:

sed '/^INSERT INTO/d' jiradb.20130118.sql > non.insert.jiradb.20130118.sql

how to import the whole jiradb:

# create the empty database
mysql --defaults-file=~/..credentials.jira -e 'create database jiradb;'
#import the DDLs:
mysql --defaults-file=~/..credentials.jira jiradb < /usr/local/BACKUP/non.insert.jiradb.20130118.sql
# make a list of the complressed datafiles per table:
find /usr/local/BACKUP/ -type f -name "*sql.gz"  > list.import.tables.txt
# execute simple export script 
root@jiragg:[Fri Jan 18 15:35:05]:[/usr/local/BACKUP]$ cat import.tables.sh
#!/bin/sh
while read tablefile
do
	echo -n "importing ${tablefile}: "
	zcat "${tablefile}" |  mysql --defaults-file=~/..credentials.jira jiradb
	echo ""
done < list.import.tables.txt

and that is it
anyway do not forget to increment the max_allowed_packet

Slackware4Life !

Categories: bash, CentOS, Linux, MySQL, RHEL Tags: , , ,

Add a new GlusterFS volume to be used by puppet master on CentOS based HA cluster

December 21, 2012 2 comments

I have puppet master running at CentOS based HA cluster of two nodes.
The install is done on two real machines connected by local direct link (crossover).
Its done using Corosync, Pacemaker, GlusterFS and MySQL

I could write the full install procedure later, now I will just add the after install creation of an additional GluasterFS volume.

the internal IPs of the two nodes are 10.0.0.4 (currently active) and 10.0.0.5m and we work at the active one :

Create the the new volume named puppe-core data directory at the bigger partition /home on both the nodes 10.0.0.{4,5}

root@puppetmaster4:[Fri Dec 21 09:32:08]:[~]$ mkdir /home/gluster-puppet-core
root@puppetmaster4:[Fri Dec 21 09:33:21]:[~]$ ssh 10.0.0.5 mkdir /home/gluster-puppet-core

Create the puppet-core glusterfs volume ONLY at ONE of the nodes, like at 10.0.0.4 :

root@puppetmaster4:[Fri Dec 21 09:33:35]:[~]$ gluster volume create puppet-core replica 2 transport tcp 10.0.0.4:/home/gluster-puppet-core 10.0.0.5:/home/gluster-puppet-core
Creation of volume puppet-core has been successful. Please start the volume to access data.

Set the allowed hosts list for that volume

root@puppetmaster4:[Fri Dec 21 09:34:16]:[~]$ gluster volume set puppet-core auth.allow  10.0.0.4,10.0.0.5
Set volume successful

Start the GlusterFS volume

root@puppetmaster4:[Fri Dec 21 09:35:03]:[~]$ gluster volume start puppet-core
Starting volume puppet-core has been successful

Check the status:

root@puppetmaster4:[Fri Dec 21 09:35:25]:[~]$ gluster volume info
 
Volume Name: puppet-mysql
Type: Replicate
Volume ID: af4b5a20-22ac-4b7d-a2b3-bda47d90ba92
Status: Started
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: 10.0.0.4:/home/puppet-mysql
Brick2: 10.0.0.5:/home/puppet-mysql
Options Reconfigured:
auth.allow: 10.0.0.5,10.0.0.4
 
Volume Name: puppet
Type: Replicate
Volume ID: 41136ba2-9063-4b6e-bd86-5f6a01ae12b4
Status: Started
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: 10.0.0.4:/home/gluster-puppet
Brick2: 10.0.0.5:/home/gluster-puppet
Options Reconfigured:
auth.allow: 10.0.0.4,10.0.0.5
 
Volume Name: puppet-files
Type: Replicate
Volume ID: 59b4c6c7-aa7e-440f-8372-2b4e141da703
Status: Started
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: 10.0.0.4:/home/puppet-files
Brick2: 10.0.0.5:/home/puppet-files
Options Reconfigured:
auth.allow: 10.0.0.5,10.0.0.4
 
Volume Name: puppet-config
Type: Replicate
Volume ID: 9200a32a-d4ef-46ce-a64e-b58c2ccbe49d
Status: Started
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: 10.0.0.4:/home/puppet-config
Brick2: 10.0.0.5:/home/puppet-config
Options Reconfigured:
auth.allow: 10.0.0.5,10.0.0.4
 
Volume Name: puppet-core
Type: Replicate
Volume ID: fc2cdbd6-3b94-4adc-b499-f3fdb452976b
Status: Started
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: 10.0.0.4:/home/gluster-puppet-core
Brick2: 10.0.0.5:/home/gluster-puppet-core
Options Reconfigured:
auth.allow: 10.0.0.4,10.0.0.5

Make the mount point

root@puppetmaster4:[Fri Dec 21 09:44:16]:[/]$ mkdir /puppet-core
root@puppetmaster4:[Fri Dec 21 09:44:37]:[/]$ ssh 10.0.0.5 mkdir /puppet-core

Create the fstab records on both the nodes as local mounts:

root@puppetmaster4:[Fri Dec 21 09:44:42]:[/]$ echo "10.0.0.4:/puppet-core  /puppet-core   glusterfs  defaults  0  0" >> /etc/fstab
root@puppetmaster4:[Fri Dec 21 09:44:45]:[/]$ ssh 10.0.0.5 echo "10.0.0.5:/puppet-core  /puppet-core   glusterfs  defaults  0  0" >> /etc/fstab

Mount the volumes:

root@puppetmaster4:[Fri Dec 21 09:44:58]:[/]$  mount /puppet-core
root@puppetmaster4:[Fri Dec 21 09:44:58]:[/]$  ssh 10.0.0.5 mount /puppet-core

set the proper ownership

root@puppetmaster4:[Fri Dec 21 09:48:53]:[/]$ ssh 10.0.0.5 chown -R puppet:puppet /puppet-core/
root@puppetmaster4:[Fri Dec 21 09:49:04]:[/]$ chown -R puppet:puppet /puppet-core

Now you may start using it, its replicated between the two nodes.

Slackware mailx send html formatted mail with PostgreSQL query result

January 29, 2012 Leave a comment

I needed monitoring script to mail particular records from a log table.

#!/bin/sh
# Sun Jan 29 22:32:22 EET 2012
# done by dragkh 

recipientMail="meee@host.com me3@host.com"
recipientID="jefe"
where="$(/bin/pwd)"
homeDir="/opt/bin"
locKFile="${homeDir}/${recipientID}.lock.alert"
SMTP="smtp.host.com:25"
FROM_MAIL="me@host.com"
LOGIN="me@host.com"
LOGIN_PASSWORD="paaa4444ssswwwd00d"



sql="
select
service_id as SID
, reason_to_fail  as ERROR 
, mesg as SMS
, shortcode as ORIGINATOR
, msisdn as MSISDN
, client_sms_id
, ext_id as smsID
, otime as OTIME
, retry as RETRY
from bsms_in_failed_requests_log
where true
and otime > now() - interval '30 minute'
order by otime
-- limit 50
;
"

status=$(echo "${sql}" |  /opt/pgsql/bin/psql -x ddlog)


echo "$(date) : result : ${status}"
#exit 0
if [ "${status}" != "" -a "${status}" != "(No rows)" ]
then 
echo "<!DOCTYPE html PUBliC \"-//W3C//DTD html 4.0 Transitional//EN\">
<html>
  <head>
    <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">
  </head>
  <body>
<h3>Slednite zaiavki sa bili othvyrleni ot HOSTBGAPI:</h3> 
<h3>Следните заявки са били отхвърлени в последните 30 минути от HOSTBGAPI:</h3> 
<pre>
${status}
</pre>
</body>
</html>
" | /usr/bin/mailx \
-vvv \
-s "HOSTBG failed requests : $(date)
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit" \
-S smtp-auth=login \
-S smtp="$SMTP" \
-S from="$FROM_MAIL" \
-S smtp-auth-user="$LOGIN" \
-S smtp-auth-password="$LOGIN_PASSWORD" \
-b me1@host.com \
"${recipientMail}"

fi

crontab -l
# notify for rejected requests : 
*/30 * * * *     /bin/sh /opt/bin/check.rejected.reqs.and.send.mail.sh >> /var/log/check.rejected.reqs.and.send.mail.log 2>&1 

enjoy 🙂

Categories: bash, PostgreSQL, Slackware Tags: , ,

Fedora release 15 (Lovelock) 64 bit Picasa 3

June 19, 2011 3 comments
yum install wine.x86_64 -y
yum localinstall picasa-2.7.3736-15.i386.rpm -y

Picasa wont run after that
ERRORS:

[Sun Jun 19 23:21:37]:[~]$ picasa
/usr/bin/picasa: line 139:  4304 Segmentation fault      (core dumped) "$PIC_BINDIR"/wrapper check_dir.exe.so
/usr/bin/picasa: line 175:  4414 Segmentation fault      (core dumped) "$PIC_BINDIR/wrapper" regedit /E $registry_export HKEY_USERS\\S-1-5-4\\Software\\Google\\Picasa\\Picasa2\\Preferences\\
istoykov@T400:[Sun Jun 19 23:22:52]:[~]$ picasa
/usr/bin/picasa: line 189:  5154 Segmentation fault      (core dumped) "$PIC_BINDIR"/wrapper check_dir.exe.so
/usr/bin/picasa: line 248:  5268 Segmentation fault      (core dumped) "$PIC_BINDIR"/wrapper set_lang.exe.so

fix :

cp /usr/bin/wine-preloader /opt/google/picasa/3.0/wine/bin/wine-preloader

original source of the fix : http://www.fedoraforum.org/forum/showthread.php?t=222601&page=2

Note :
if you have the issue with the following error :
HttpOpenRequest failed (12157) –
https://www.google.com/accounts/ClientAuth [13]

use this work around :

cp /usr/lib/wine/wininet.dll.so /opt/google/picasa/3.0/wine/lib/wine/wininet.dll.so

original source of the fix : http://www.google.com/support/forum/p/Picasa/thread?tid=6eb9c7d06d5aa10c&hl=en