diff --git a/agc_2-X/trunk/bin/AST_DB_tz_divide.pl b/agc_2-X/trunk/bin/AST_DB_tz_divide.pl new file mode 100644 index 00000000..016231d3 --- /dev/null +++ b/agc_2-X/trunk/bin/AST_DB_tz_divide.pl @@ -0,0 +1,142 @@ +#!/usr/bin/perl +# +# AST_DB_tz_divide.pl version 2.0.4 *DBI-version* +# +# DESCRIPTION: +# OPTIONAL!!! CUSTOMIZE THIS SCRIPT FIRST!!! +# separates leads into two different lists +# +# It is recommended that you run this program on the local Asterisk machine +# +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 +# +# CHANGES +# 71106-0250 - first build +# + +# default path to astguiclient configuration file: +$PATHconf = '/etc/astguiclient.conf'; + +open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; +@conf = ; +close(conf); +$i=0; +foreach(@conf) + { + $line = $conf[$i]; + $line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi; + if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) ) + {$PATHhome = $line; $PATHhome =~ s/.*=//gi;} + if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) ) + {$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;} + if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) ) + {$PATHagi = $line; $PATHagi =~ s/.*=//gi;} + if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) ) + {$PATHweb = $line; $PATHweb =~ s/.*=//gi;} + if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) ) + {$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;} + if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) ) + {$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;} + if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) ) + {$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) ) + {$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) + {$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) ) + {$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) ) + {$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;} + if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) ) + {$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;} + $i++; + } + +# Customized Variables +$server_ip = $VARserver_ip; # Asterisk server IP + +if (!$VARDB_port) {$VARDB_port='3306';} + +use DBI; + +$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass") + or die "Couldn't connect to database: " . DBI->errstr; + +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + + +if ($isdst) {$TZmove = "'-6.00','-7.00','-8.00','-9.00','-10.00'";} +else {$TZmove = "'-7.00','-8.00','-9.00','-10.00','-11.00'";} + + $stmtA = "UPDATE vicidial_list set list_id='222' where list_id='111' and gmt_offset_now IN($TZmove);"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + $stmtA = "UPDATE vicidial_list set list_id='12021' where list_id='11315' and gmt_offset_now IN($TZmove);"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + +$secX = time(); + +$XDtarget = ($secX - 2678400); +($Xsec,$Xmin,$Xhour,$Xmday,$Xmon,$Xyear,$Xwday,$Xyday,$Xisdst) = localtime($XDtarget); +$Xyear = ($Xyear + 1900); +$Xmon++; +if ($Xmon < 10) {$Xmon = "0$Xmon";} +if ($Xmday < 10) {$Xmday = "0$Xmday";} +if ($Xhour < 10) {$Xhour = "0$Xhour";} +if ($Xmin < 10) {$Xmin = "0$Xmin";} +if ($Xsec < 10) {$Xsec = "0$Xsec";} + $XDSQLdate = "$Xyear-$Xmon-$Xmday $Xhour:$Xmin:$Xsec"; + +$TDtarget = ($secX - 5356800); +($Tsec,$Tmin,$Thour,$Tmday,$Tmon,$Tyear,$Twday,$Tyday,$Tisdst) = localtime($TDtarget); +$Tyear = ($Tyear + 1900); +$Tmon++; +if ($Tmon < 10) {$Tmon = "0$Tmon";} +if ($Tmday < 10) {$Tmday = "0$Tmday";} +if ($Thour < 10) {$Thour = "0$Thour";} +if ($Tmin < 10) {$Tmin = "0$Tmin";} +if ($Tsec < 10) {$Tsec = "0$Tsec";} + $TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec"; + + $stmtA = "UPDATE vicidial_list set list_id='999999' where list_id IN('11315','12021','111','222') and entry_date < \"$XDSQLdate\";"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + $stmtA = "DELETE from vicidial_list WHERE list_id='999999' and entry_date < \"$TDSQLdate\";"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + + + $dbhA->disconnect(); + +exit; diff --git a/agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt b/agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt index 9e94068c..75dcef99 100644 --- a/agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt +++ b/agc_2-X/trunk/docs/REQUIRED_APPS_INSTALL.txt @@ -138,20 +138,20 @@ cd zlib-1.2.3 make make install cd /usr/local -wget http://gulus.usherbrooke.ca/pub/appl/ssh/OpenSSH/portable/openssh-4.6p1.tar.gz -gunzip openssh-4.6p1.tar.gz -tar xvf openssh-4.6p1.tar -cd openssh-4.6p1 +wget http://gulus.usherbrooke.ca/pub/appl/ssh/OpenSSH/portable/openssh-4.7p1.tar.gz +gunzip openssh-4.7p1.tar.gz +tar xvf openssh-4.7p1.tar +cd openssh-4.7p1 ./configure make make install cd /usr/local -wget http://www.openssl.org/source/openssl-0.9.8e.tar.gz -gunzip openssl-0.9.8e.tar.gz -tar xvf openssl-0.9.8e.tar -cd openssl-0.9.8e +wget http://www.openssl.org/source/openssl-0.9.8g.tar.gz +gunzip openssl-0.9.8g.tar.gz +tar xvf openssl-0.9.8g.tar +cd openssl-0.9.8g ./config make make install diff --git a/agc_2-X/trunk/docs/SCRATCH_INSTALL.txt b/agc_2-X/trunk/docs/SCRATCH_INSTALL.txt index 01b7012c..4c038c9d 100644 --- a/agc_2-X/trunk/docs/SCRATCH_INSTALL.txt +++ b/agc_2-X/trunk/docs/SCRATCH_INSTALL.txt @@ -390,6 +390,10 @@ NOTE: a minimum of MySQL server 4.0.X is required - cp /usr/local/mysql-5.0.27/libmysql/.libs/libmysqlclient.so.15 /usr/lib/ - you are done + ** INSTALLATION NOTE ** + If you are having Linuxthreads problems upon onfigure, just execute the following command: + echo '/* Linuxthreads */' >> /usr/include/pthread.h + ***** NOTE: if you will be using any of the DBI perl scripts: ***** Every machine that you will be using the newer BDI perl scripts on will need to have the perl modules DBI and DBD::mysql installed on them. To do this @@ -632,10 +636,10 @@ updated on your system, so we're going to install a new version now. - make - make install - cd /usr/local - - wget http://gulus.usherbrooke.ca/pub/appl/ssh/OpenSSH/portable/openssh-4.6p1.tar.gz - - gunzip openssh-4.6p1.tar.gz - - tar xvf openssh-4.6p1.tar - - cd openssh-4.6p1 + - wget http://gulus.usherbrooke.ca/pub/appl/ssh/OpenSSH/portable/openssh-4.7p1.tar.gz + - gunzip openssh-4.7p1.tar.gz + - tar xvf openssh-4.7p1.tar + - cd openssh-4.7p1 - ./configure - make - make install @@ -650,10 +654,10 @@ your locally installed copy of Apache web server) 9. Go to http://www.openssl.org/ and download the linux source for openssl - to install this directly on the command line type: - cd /usr/local - - wget http://www.openssl.org/source/openssl-0.9.8e.tar.gz - - gunzip openssl-0.9.8e.tar.gz - - tar xvf openssl-0.9.8e.tar - - cd openssl-0.9.8e + - wget http://www.openssl.org/source/openssl-0.9.8g.tar.gz + - gunzip openssl-0.9.8g.tar.gz + - tar xvf openssl-0.9.8g.tar + - cd openssl-0.9.8g - ./config - make - make install