Archive

Archive for the ‘Slackware’ Category

Update bash at Slackware 11 with the latest patch against shellshock bugs CVE-2014-6271 CVE-2014-7169 CVE-2014-7186 CVE-2014-7187

October 1, 2014 1 comment

I still have Slackware 11 machines … so I had to recompile the bash

I took a moment to read this nice blog related to shellshock: http://chester.me/archives/2014/09/building-bash-from-source-shellshock-mitigation/
So in short what I did at my Slackware 11 machines:

root@DL-380:[Wed Oct 01 23:05:47]:[~]$ cat /etc/slackware-version 
Slackware 11.0.0
root@DL-380:[Wed Oct 01 23:05:47]:[/opt/installs]$ bash --version
GNU bash, version 3.1.17(2)-release (i486-slackware-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

root@DL-380:[Wed Oct 01 23:06:02]:[/opt/installs]$ wget  http://ftp.gnu.org/gnu/bash/bash-3.1.tar.gz
root@DL-380:[Wed Oct 01 23:06:35]:[/opt/installs]$ lftp http://ftp.gnu.org/gnu/bash
cd: received redirection to `http://ftp.gnu.org/gnu/bash/'
cd ok, cwd=/gnu/bash                               
lftp ftp.gnu.org:/gnu/bash> mirror bash-3.1-patches 
Total: 1 directory, 44 files, 0 symlinks                  
New: 44 files, 0 symlinks
60375 bytes transferred in 5 seconds (11.3K/s)
lftp ftp.gnu.org:/gnu/bash> exit
root@DL-380:[Wed Oct 01 23:07:39]:[/opt/installs]$ rm bash-3.1-patches/*sig
root@DL-380:[Wed Oct 01 23:07:53]:[/opt/installs]$ tar xvf bash-3.1.tar.gz 
root@DL-380:[Wed Oct 01 23:08:54]:[/opt/installs]$ cd bash-3.1
root@DL-380:[Wed Oct 01 23:08:59]:[/opt/installs/bash-3.1]$ 
root@DL-380:[Wed Oct 01 23:08:59]:[/opt/installs/bash-3.1]$ for patch_file in `find /opt/installs/bash-3.1-patches/ -type f `;  do echo $patch_file && patch -p0 < $patch_file ; done
root@DL-380:[Wed Oct 01 23:09:23]:[/opt/installs/bash-3.1]$ tail patchlevel.h
#if !defined (_PATCHLEVEL_H_)
#define _PATCHLEVEL_H_

/* It's important that there be no other strings in this file that match the
   regexp `^#define[     ]*PATCHLEVEL', since that's what support/mkversion.sh
   looks for to find the patch level (for the sccs version string). */

#define PATCHLEVEL 21

#endif /* _PATCHLEVEL_H_ */
root@DL-380:[Wed Oct 01 23:09:44]:[/opt/installs/bash-3.1]$ ./configure 
root@DL-380:[Wed Oct 01 23:10:49]:[/opt/installs/bash-3.1]$ make --j3 
ls -l bash
-rwxr-xr-x 1 root root 1556950 2014-10-01 23:11 bash
size bash
   text       data        bss        dec        hex    filename
 634120      22840      19432     676392      a5228    bash
root@DL-380:[Wed Oct 01 23:11:19]:[/opt/installs/bash-3.1]$ 
root@DL-380:[Wed Oct 01 23:11:19]:[/opt/installs/bash-3.1]$ env x='() { :;}; echo vulnerable' bash -c "echo this is a test" 
vulnerable
this is a test
root@DL-380:[Wed Oct 01 23:12:36]:[/opt/installs/bash-3.1]$ env x='() { :;}; echo vulnerable' ./bash -c "echo this is a test" 
this is a test
root@DL-380:[Wed Oct 01 23:12:41]:[/opt/installs/bash-3.1]$ ./bash --version
GNU bash, version 3.1.21(2)-release (i686-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
root@DL-380:[Wed Oct 01 23:12:46]:[/opt/installs/bash-3.1]$ which bash
/usr/bin/bash
root@DL-380:[Wed Oct 01 23:13:11]:[/opt/installs/bash-3.1]$ file /usr/bin/bash
/usr/bin/bash: symbolic link to `/bin/bash'
root@DL-380:[Wed Oct 01 23:13:15]:[/opt/installs/bash-3.1]$ file /bin/bash
/bin/bash: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), stripped
root@DL-380:[Wed Oct 01 23:13:18]:[/opt/installs/bash-3.1]$ cp -fp bash /bin/bash
root@DL-380:[Wed Oct 01 23:13:28]:[/opt/installs/bash-3.1]$ env x='() { :;}; echo vulnerable' bash -c "echo this is a test" 
this is a test
root@DL-380:[Wed Oct 01 23:13:43]:[/opt/installs/bash-3.1]$ (for x in {1..200} ; do echo "for x$x in ; do :"; done; for x in {1..200} ; do echo done ; done) | bash || echo "CVE-2014-7187 vulnerable, word_lineno" 
root@DL-380:[Wed Oct 01 23:13:53]:[/opt/installs/bash-3.1]$ bash -c 'true <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF' || echo "CVE-2014-7186 vulnerable, redir_stack" 
root@DL-380:[Wed Oct 01 23:14:02]:[/opt/installs/bash-3.1]$ 

Done

Slackware4LIfe πŸ™‚

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: , , , , ,

Compile svn kannel sqlbox and opensmmp with PostgreSQL and gsoap support at CentOS 6.2 x86_64 GNU/Linux

November 29, 2012 2 comments

1, install PostgreSQL 9.2 from the official postgresql.org repository

yum -y install wget bash-completion
wget http://yum.postgresql.org/9.2/redhat/rhel-6-i386/pgdg-centos92-9.2-6.noarch.rpm
yum localinstall --nogpgcheck pgdg-centos92-9.2-6.noarch.rpm
yum install postgresql92-server postgresql92-plperl postgresql92-pltcl postgresql92-devel postgresql92-docs postgresql92-libs postgresql92-plpython postgresql92-contrib -y 
yum install skytools-92 skytools-92-modules pgtune pgbouncer pgagent_92 pg_top92 bucardo

2. install kannel with PostgreSQL and soap interface

yum install automake  pcre* mlocate -y
yum groupinstall 'Development Tools'
yum install libxml2-devel -y
yum install openssl-devel -y 
mkdir /opt/installs/kannel.svn &amp;&amp; cd /opt/installs/kannel.svn
svn co https://svn.kannel.org/gateway/trunk
cd /opt/installs/
svn co https://gsoap2.svn.sourceforge.net/svnroot/gsoap2 gsoap2
cd gsoap2
./configure

The build will fail with the following error :

make -j3
cd . &amp;&amp; /bin/sh /opt/installs/gsoap2/missing --run autoconf
 cd . &amp;&amp; /bin/sh /opt/installs/gsoap2/missing --run automake-1.10 --foreign 
/opt/installs/gsoap2/missing: line 46: automake-1.10: command not found
WARNING: `automake-1.10' is needed, and you do not seem to have it handy on your
         system.  You might have modified some files without having the
         proper tools for further handling them.  Check the `README' file,
         it often tells you about the needed prerequirements for installing
         this package.  You may also peek at any GNU archive site, in case
         some other package would contain this missing `automake-1.10' program.
make: *** [Makefile.in] Error 1
make: *** Waiting for unfinished jobs....
aclocal.m4:14: error: this file was generated for autoconf 2.61.
You have another version of autoconf.  If you want to use that,
you should regenerate the build system entirely.
aclocal.m4:14: the top level
autom4te: /usr/bin/m4 failed with exit status: 63
WARNING: `autoconf' is missing on your system.  You should only need it if
         you modified `configure.in'.  You might want to install the
         `Autoconf' and `GNU m4' packages.  Grab them from any GNU
         archive site.

After some digging into the source and googling in deep, the fix is simple, but very efficient …:

cd /opt/installs/gsoap2/
touch config.h.in
touch Makefile.in
touch configure
# NOW you can build it πŸ™‚ 
make -j3
.....
**  The gSOAP code generator for C and C++, soapcpp2 release 2.8.11
**  Copyright (C) 2000-2012, Robert van Engelen, Genivia Inc.
**  All Rights Reserved. This product is provided "as is", without any warranty.
**  The soapcpp2 tool is released under one of the following two licenses:
**  GPL or the commercial license by Genivia Inc.

Saving wsdlStub.h annotated copy of the input declarations
Saving xmime.nsmap namespace mapping table
Saving wsdlH.h interface declarations
Saving wsdlC.cpp XML serializers

Compilation successful
....
# install it : 
make -j3  install 
....
+--------------------------------------------------------+
| You now have successfully built and installed gsoap.   |
|                                                        |
| You can link your programs with -lgsoap++ for          |
| C++ projects created with soapcpp2 and you can link    |
| with -lgsoap for C projects generated with soapcpp2 -c |
|                                                        |
| There are also corresponding libraries for SSL and     |
| zlib compression support (-lgsoapssl and lgsoapssl++)  |
| which require linking -lssl -lcrypto -lz               |
|                                                        |
| Thanks for using gsoap.                                |
|                                                        |
|               http://sourceforge.net/projects/gsoap2   |
+--------------------------------------------------------+

Now go for the kannel install

cd /opt/installs/kannel.svn/trunk/
./configure  --with-pgsql --enable-ssl --with-gsoap --enable-start-stop-daemon --enable-pcre
# it will fail due to missing libpq-fe.h
# fix it by creating the proper link 
ln -s /usr/pgsql-9.2/ /usr/pgsql
# now try again
./configure  --with-pgsql --enable-ssl --with-gsoap --enable-start-stop-daemon --enable-pcre
# it will fails AGAIN πŸ™‚ with the following error : 
Configuring for gSOAP support ...
checking whether to compile with SOAP support... not found
configure: error: Unable to find gSOAP import at /usr/share/gsoap/import or plugin at /usr/share/gsoap/plugin
root@aegir.voicecom.bg:[Thu Nov 29 23:11:29]:[/opt/installs/kannel.svn/trunk]$ /usr/local/bin/soapcpp2 -d `dirname soap/service/parlayx/soapH.h` -I /usr/share/gsoap/import -I soap/service/parlayx -cLxw soap/service/parlayx/parlayx_sms_send_service_2_1_wrapper.h

**  The gSOAP code generator for C and C++, soapcpp2 release 2.8.11
**  Copyright (C) 2000-2012, Robert van Engelen, Genivia Inc.
**  All Rights Reserved. This product is provided "as is", without any warranty.
**  The soapcpp2 tool is released under one of the following two licenses:
**  GPL or the commercial license by Genivia Inc.

Critical error: #import: Cannot open file "wsse.h" for reading.
Hint: use option -I<path> (for example -Igsoap/import:gsoap/custom:.)

# Fix that with creating the proper link :
ln -s /usr/local/share/gsoap /usr/share/

# now try again
./configure  --with-pgsql --enable-ssl --with-gsoap --enable-start-stop-daemon --enable-pcre
......
License information ...
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the Kannel Software License, available |
| in this distribution in the file LICENSE. By continuing this       |
| installation process, you are bound by the terms of this license   |
| agreement. If you do not agree with the terms of this license, you |
| must abort the installation process at this point.                 |
|                                                                    |
|                      The Kannel Group <http://www.kannel.org/>     |
+--------------------------------------------------------------------+

Thank you for using Kannel.

# now compile and install 
make -j3 install 
.....
Using project directory path: soap/service/parlayx/
Saving soap/service/parlayx/soapStub.h annotated copy of the input declarations
Using px1 service name: SendSmsBinding
Using px1 service style: document
Using px1 service encoding: literal
Using px1 service location: http://localhost:9080/ParlayXSms/services/SendSms
Using px1 schema namespace: http://www.csapi.org/wsdl/parlayx/sms/send/v2_1/service
Saving soap/service/parlayx/SendSmsBinding.nsmap namespace mapping table
Using px2 service name: SmsNotificationBinding
Using px2 service style: document
Using px2 service encoding: literal
Using px2 service location: http://localhost:9080/SmsNotificationService/services/SmsNotification
Using px2 schema namespace: http://www.csapi.org/wsdl/parlayx/sms/notification/v2_1/service
Saving soap/service/parlayx/SmsNotificationBinding.nsmap namespace mapping table
Using px3 service name: ReceiveSmsBinding
Using px3 service style: document
Using px3 service encoding: literal
Using px3 service location: http://localhost:9080/ReceiveSmsService/services/ReceiveSms
Using px3 schema namespace: 
Saving soap/service/parlayx/ReceiveSmsBinding.nsmap namespace mapping table
Saving soap/service/parlayx/soapClient.c client calling stubs
Saving soap/service/parlayx/soapServer.c server request dispatcher
Saving soap/service/parlayx/soapH.h interface declarations
Saving soap/service/parlayx/soapC.c XML serializers

Compilation successful
.....

Complile and install opensmppbox :

cd /opt/installs/kannel.svn/trunk/addons/opensmppbox
./bootstrap
./configure
make -j3 install 

Complile and install sqlbox :

cd /opt/installs/kannel.svn/trunk/addons/sqlbox
./bootstrap
./configure
make -j3 install 

Check the install :

cd /usr/local/sbin
root@darkstart:[Thu Nov 29 23:24:31]:[/usr/local/sbin]$ ls
bearerbox  opensmppbox  run_kannel_box  smsbox  sqlbox  start-stop-daemon  wapbox

aaand that is it ,,, Slackware4Life .. πŸ˜€

Compile MariaDB 5.5.28 MySQL on Slackware i486-slackware-linux-gcc-3.3.4 with Cmake 2.8.10.1

November 27, 2012 Leave a comment

1. install Cmake

wget  http://www.cmake.org/files/v2.8/cmake-2.8.10.1.tar.gz
tar xvfz cmake-2.8.10.1.tar.gz
cd cmake-2.8.10.1/
./configure
gmake -j3
ο»Ώο»Ώ

2. install libaio

gmake -wget  http://www.kernel.org/pub/linux/kernel/people/bcrl/aio/libaio-0.3.92.tar.gz
tar xvfz libaio-0.3.92.tar.gz
cd libaio-0.3.92/
make prefix=/usr/
make prefix=/usr/ installj3 install

3. install MariaDB 5.5.28
go to https://downloads.mariadb.org/mariadb/5.5.28/ OR

wget https://downloads.mariadb.org/f/mariadb-5.5.28/kvm-tarbake-jaunty-x86/mariadb-5.5.28.tar.gz/from/http:/mariadb.ulak.net.tr/
tar xvf mariadb-5.5.28.tar.gz
cd mariadb-5.5.28/

the build will fail :

root@bubu:[Tue Nov 27 10:15:45]:[/opt/installs/mariadb-5.5.28]$ ./BUILD/compile-pentium-max
testing pentium3 ... ok
+++ /bin/rm -rf configure
+++ /bin/rm -rf CMakeCache.txt CMakeFiles/
+++ path=./BUILD
+++ . ./BUILD/autorun.sh
+++++ dirname ./BUILD/compile-pentium-max
++++ path=./BUILD
++++ cp ./BUILD/cmake_configure.sh ./BUILD/../configure
++++ chmod +x ./BUILD/../configure
+++ CC='ccache gcc'
+++ CFLAGS='-Wall -Wextra -Wunused -Wwrite-strings -Wno-uninitialized -mcpu=pentium3 -O3 -fno-omit-frame-pointer -g  '
+++ CXX='ccache g++'
+++ CXXFLAGS='-Wall -Wextra -Wunused -Wwrite-strings -Wno-uninitialized -Wno-unused-parameter -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -mcpu=pentium3 -O3 -fno-omit-frame-pointer -g  '
+++ CXXLDFLAGS=
+++ ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-plugin-aria --with-aria-tmp-tables --with-readline --with-ssl --with-plugins=max --with-embedded-server --with-libevent --enable-local-infile
configure.pl : calling cmake /opt/installs/mariadb-5.5.28  -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DENABLE_ASSEMBLER=1 -DWITH_EXTRA_CHARSETS=complex -DENABLE_THREAD_SAFE_CLIENT=1 -DWITH_BIG_TABLES=1 -DWITH_PLUGIN_ARIA=1 -DWITH_ARIA_TMP_TABLES=1 -DWITH_READLINE=1 -DWITH_SSL=bundled -DWITH_MAX=1 -DWITH_EMBEDDED_SERVER=1 -DWITH_LIBEVENT=1 -DENABLE_LOCAL_INFILE=1
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/ccache
-- Check for working C compiler: /usr/bin/ccache -- broken
CMake Error at /usr/local/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/usr/bin/ccache" is not able to compile a simple test
  program.

  It fails with the following output:

   Change Dir: /opt/installs/mariadb-5.5.28/CMakeFiles/CMakeTmp

  

  Run Build Command:/usr/bin/gmake "cmTryCompileExec591660954/fast"

  /usr/bin/gmake -f CMakeFiles/cmTryCompileExec591660954.dir/build.make
  CMakeFiles/cmTryCompileExec591660954.dir/build

  gmake[1]: Entering directory
  `/opt/installs/mariadb-5.5.28/CMakeFiles/CMakeTmp'

  /usr/local/bin/cmake -E cmake_progress_report
  /opt/installs/mariadb-5.5.28/CMakeFiles/CMakeTmp/CMakeFiles 1

  Building C object
  CMakeFiles/cmTryCompileExec591660954.dir/testCCompiler.c.o

  /usr/bin/ccache gcc -Wall -Wextra -Wunused -Wwrite-strings
  -Wno-uninitialized -mcpu=pentium3 -O3 -fno-omit-frame-pointer -g -o
  CMakeFiles/cmTryCompileExec591660954.dir/testCCompiler.c.o -c
  /opt/installs/mariadb-5.5.28/CMakeFiles/CMakeTmp/testCCompiler.c

  cc1: error: unrecognized option `-Wextra'

  gmake[1]: Leaving directory
  `/opt/installs/mariadb-5.5.28/CMakeFiles/CMakeTmp'

  gmake[1]: *** [CMakeFiles/cmTryCompileExec591660954.dir/testCCompiler.c.o]
  Error 1

  gmake: *** [cmTryCompileExec591660954/fast] Error 2

  

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:70 (PROJECT)


-- Configuring incomplete, errors occurred!
+++ gmake -j 6
-- The C compiler identification is unknown
-- The CXX compiler identification is GNU 3.3.4
-- Check for working C compiler: /usr/bin/ccache
-- Check for working C compiler: /usr/bin/ccache -- broken
CMake Error at /usr/local/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/usr/bin/ccache" is not able to compile a simple test
  program.

  It fails with the following output:

   Change Dir: /opt/installs/mariadb-5.5.28/CMakeFiles/CMakeTmp

  

  Run Build Command:/usr/bin/gmake "cmTryCompileExec3386681460/fast"

  gmake[1]: Entering directory
  `/opt/installs/mariadb-5.5.28/CMakeFiles/CMakeTmp'

  /usr/bin/gmake -f CMakeFiles/cmTryCompileExec3386681460.dir/build.make
  CMakeFiles/cmTryCompileExec3386681460.dir/build

  gmake[2]: Entering directory
  `/opt/installs/mariadb-5.5.28/CMakeFiles/CMakeTmp'

  /usr/local/bin/cmake -E cmake_progress_report
  /opt/installs/mariadb-5.5.28/CMakeFiles/CMakeTmp/CMakeFiles 1

  Building C object
  CMakeFiles/cmTryCompileExec3386681460.dir/testCCompiler.c.o

  /usr/bin/ccache gcc -Wall -Wextra -Wunused -Wwrite-strings
  -Wno-uninitialized -mcpu=pentium3 -O3 -fno-omit-frame-pointer -g -o
  CMakeFiles/cmTryCompileExec3386681460.dir/testCCompiler.c.o -c
  /opt/installs/mariadb-5.5.28/CMakeFiles/CMakeTmp/testCCompiler.c

  cc1: error: unrecognized option `-Wextra'

  gmake[2]: Leaving directory
  `/opt/installs/mariadb-5.5.28/CMakeFiles/CMakeTmp'

  gmake[2]: *** [CMakeFiles/cmTryCompileExec3386681460.dir/testCCompiler.c.o]
  Error 1

  gmake[1]: Leaving directory
  `/opt/installs/mariadb-5.5.28/CMakeFiles/CMakeTmp'

  gmake[1]: *** [cmTryCompileExec3386681460/fast] Error 2

  

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:70 (PROJECT)


-- Configuring incomplete, errors occurred!
gmake: *** [cmake_check_build_system] Error 1

REASON for the fail :
Since you use -Wall to report all warning, the two flags -Wall -Wextra are redundant.
However gcc treat them as errors and stop compiling.

FIX :

## make backup of of the Build script
cp -p    BUILD/SETUP.sh BUILD/SETUP.sh.ORIGINAL

# fix the Wextra issues 
root@bubu:[Tue Nov 27 10:19:41]:[/opt/installs/mariadb-5.5.28]$ sed -i 's/-Wextra//' BUILD/SETUP.sh

# Now run the build again, it will not fail, make sure your home directory has enough space for the ~/.ccache 
root@bubu:[Tue Nov 27 10:21:11]:[/opt/installs/mariadb-5.5.28]$ ./BUILD/compile-pentium-max 

Enjoy Slackware πŸ™‚

Categories: bash, Linux, MySQL, Slackware Tags: , , ,

How to install inotail at CentOS 6.3

August 13, 2012 Leave a comment

yum install inotify-tools
#Name        : inotify-tools
#Arch        : x86_64
#Version     : 3.14

git clone git://git.distanz.ch/inotail.git
cd inotail
make install 
inotail  -V
#inotail 0.6

#Slackware4LIfe!

Linux bash script for creating new tables and rules for huge partitioned PostgreSQL table

May 20, 2012 Leave a comment

in general this script is editable to be started on 1st of December each year

#!/bin/sh
# 2012-05-19 05:54:39.946835+03
# HLR lookups control tasks hor sharting
# inject new tables and rules for partitioned HLR lookups table 
# for s_year in '2012' # skip 2013
# set a cron at 1st of December , every year

echo "
CREATE TABLE IF NOT EXISTS bsms_in_hlr_tasks
(
  task_id character varying(90) NOT NULL,
  msisdn bigint NOT NULL,
  sid integer NOT NULL,
  ext_id character varying(90) NOT NULL,
  ops_to_be_processed integer[] NOT NULL DEFAULT '{1,2,3}'::integer[],
  status integer NOT NULL DEFAULT 0,
  intime timestamp without time zone NOT NULL DEFAULT now(),
  ptime timestamp without time zone,
  control_date date NOT NULL, -- partitioning per date
  CONSTRAINT bsms_in_hlr_tasks_pkey PRIMARY KEY (task_id )
)
WITH (
  OIDS=FALSE
);
"

# for s_year in $(date +%Y --date="next year")
for s_year in 2012 $(date +%Y --date="next year")
do

for s_manth in `seq 1 12`
do


if [ "${s_manth}" == "12" ]
then
	(( n_year =  s_year + 1)) 
	n_month=01
else
	echo "-- calculating next month of ${s_manth} before december"
	n_year=${s_year}
	s_month=${s_manth#0}
	(( n_month= s_month +1 )) 
fi


if [ ${#s_manth} -eq 1 ]
then
	s_manth="0${s_manth}"
fi

if [ ${#n_month} -eq 1 ]
then
	n_month="0${n_month}"
fi

show=1
if [ "${show}" == "1" ]
then
echo " 
CREATE TABLE if not exists bsms_in_hlr_tasks_y${s_year}m${s_manth} (
    CHECK ( control_date >= DATE '${s_year}-${s_manth}-01' AND control_date < DATE '${n_year}-${n_month}-01' )
,CONSTRAINT bsms_in_hlr_tasks_y${s_year}m${s_manth}_pkey PRIMARY KEY (task_id )
) INHERITS (bsms_in_hlr_tasks);

CREATE INDEX bsms_in_hlr_tasks_y${s_year}m${s_manth}_ext_id_idx
  ON bsms_in_hlr_tasks_y${s_year}m${s_manth}
  USING btree
  (ext_id );

CREATE RULE OR REPLACE route_bsms_in_hlr_tasks_y${s_year}m${s_manth} AS
ON INSERT TO bsms_in_hlr_tasks WHERE
    ( control_date >= DATE '${s_year}-${s_manth}-01' AND control_date < DATE '${n_year}-${n_month}-01'  )
DO INSTEAD
    INSERT INTO bsms_in_hlr_tasks_y${s_year}m${s_manth} VALUES (NEW.*);
"

fi; 
done

done

Install Redis stable (2.4.13) on CentOS release 6.2 x86_64 and Slackware 12.0.0 i686

May 15, 2012 Leave a comment

just follow the instructions here : http://redis.io/topics/quickstart

there is small issue with the Slackware 12.0.0 install – the default tclsh version installed is tclsh8.4
so after the make is done, on make test you will see this error at Slackware shell:

Hint: To run 'make test' is a good idea πŸ˜‰

make[1]: Leaving directory `/opt/installs/redis-2.4.13/src'
root@darkwater:[Tue May 15 18:01:17]:[/opt/installs/redis-2.4.13]$ make test
cd src && make test
make[1]: Entering directory `/opt/installs/redis-2.4.13/src'
which: no tclsh8.5 in (/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib/java/bin:/usr/lib/java/jre/bin:/usr/lib/java/bin:/usr/lib/java/jre/bin:/usr/lib/qt/bin:/usr/share/texmf/bin:/opt/pgsql/bin:/opt/mysql/bin:/usr/local/ssl/bin:/opt/kannel/sbin:/opt/apache2/bin)
You need 'tclsh8.5' in order to run the Redis test
make[1]: *** [test] Error 1
make[1]: Leaving directory `/opt/installs/redis-2.4.13/src'
make: *** [test] Error 2
root@darkwater:[Tue May 15 18:01:21]:[/opt/installs/redis-2.4.13]$ locate tclsh
locate: warning: database /var/lib/slocate/slocate.db' is more than 8 days old
/usr/bin/tclsh
/usr/bin/tclsh8.4

how to fix that – install the latest tcl and deinstall the old one :


wget http://prdownloads.sourceforge.net/tcl/tcl8.5.11-src.tar.gz
tar xvfz tcl8.5.11-src.tar.gz
cd tcl8.5.11/
cd unix/
./configure
make -j3
removepkg tcl-8.4.15-i486-1
make install
ldconfig

then proceed with the usual Redis install
the debian init script works for Slackware, just configure it

cp redis_init_script /etc/rc.d/rc.redis
chmod +x /etc/rc.d/rc.redis

and add the stop / start execution of the script at the rc.0 and rc.3 script in a view to stop properly and to start on boot

Regarding the CentOS install ,
there is epel package ready for install version 2.4.10:


root@aegir.ee:[Tue May 15 21:48:38]:[~]$ yum info redis
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.skknet.net
 * epel: mirror.telepoint.bg
 * extras: centos.skknet.net
 * updates: centos.skknet.net
Available Packages
Name        : redis
Arch        : x86_64
Version     : 2.4.10
Release     : 1.el6
Size        : 213 k
Repo        : epel
Summary     : A persistent key-value database
URL         : http://redis.io
License     : BSD
Description : Redis is an advanced key-value store. It is similar to memcached but the data
            : set is not volatile, and values can be strings, exactly like in memcached, but
            : also lists, sets, and ordered sets. All this data types can be manipulated with
            : atomic operations to push/pop elements, add/remove elements, perform server side
            : union, intersection, difference between sets, and so forth. Redis supports
            : different kind of sorting abilities.

however I do prefer the latest stable version compiled from source, so I installed Redis by http://redis.io/topics/quickstart

the provided init script will start the redis server but will not be recognized by chkconfig,
so the fast way to set the start stop init script for Redis is to follow the instructions here:

http://www.saltwebsites.com/2012/install-redis-245-service-centos-6

and that is all, you may start playing with this amazing Redis