From 95a7645b959d857d368b5c00aa2021c7ed5014fe Mon Sep 17 00:00:00 2001 From: mattf Date: Mon, 7 Aug 2006 17:46:32 +0000 Subject: [PATCH] changed ADMIN_keepalive scripts to use /etc/astguiclient.conf for settings fchanged MP3_DATE script to use /etc/astguiclient.conf for settings git-svn-id: svn://192.168.202.10@123 3d104415-ff17-0410-8863-d5cf3c621b8a --- bin/ADMIN_keepalive_AST_VDautodial.pl | 28 +++++++++++-- bin/ADMIN_keepalive_AST_VDremote_agents.pl | 32 +++++++++++++-- bin/ADMIN_keepalive_AST_update.pl | 26 ++++++++++-- bin/AST_CRON_mix_recordings_MP3_DATE.pl | 48 +++++++++++++++++++++- 4 files changed, 121 insertions(+), 13 deletions(-) diff --git a/bin/ADMIN_keepalive_AST_VDautodial.pl b/bin/ADMIN_keepalive_AST_VDautodial.pl index b40027f7..4ceeccf0 100644 --- a/bin/ADMIN_keepalive_AST_VDautodial.pl +++ b/bin/ADMIN_keepalive_AST_VDautodial.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# ADMIN_keepalive_AST_VDauto_dial.pl version 0.3 +# ADMIN_keepalive_AST_VDauto_dial.pl version 0.4 # # designed to keep the AST_update processes aline and check every minute # @@ -9,6 +9,7 @@ # # 50810-1452 - removed '-L' flag for screen logging of output (optimization) # 50823-1454 - Added commandline debug options with debug printouts +# 60807-1315 - changed to use /etc/astguiclient.conf for settings # $DB=0; # Debug flag @@ -54,6 +55,25 @@ else ### end parsing run-time options ### +# 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;} + $i++; + } + +$REGhome = $PATHhome; +$REGhome =~ s/\//\\\//gi; + #@psoutput = `ps -f -C AST_update --no-headers`; #@psoutput = `ps -f -C AST_updat* --no-headers`; #@psoutput = `/bin/ps -f --no-headers -A`; @@ -68,7 +88,7 @@ foreach (@psoutput) if ($DBX) {print "$i|$psoutput[$i]| \n";} @psline = split(/\/usr\/bin\/perl /,$psoutput[$i]); -if ($psline[1] =~ /\/home\/cron\/AST_VDauto_dial\.pl/) +if ($psline[1] =~ /$REGhome\/AST_VDauto_dial\.pl/) { $running_VDAD++; if ($DB) {print "VDAD RUNNING: |$psline[1]|\n";} @@ -95,7 +115,7 @@ foreach (@psoutput2) if ($DBX) {print "$i|$psoutput[$i]| \n";} @psline = split(/\/usr\/bin\/perl /,$psoutput2[$i]); - if ($psline[1] =~ /\/home\/cron\/AST_VDauto_dial\.pl/) + if ($psline[1] =~ /$REGhome\/AST_VDauto_dial\.pl/) { $running_VDAD++; if ($DB) {print "VDAD RUNNING: |$psline[1]|\n";} @@ -108,7 +128,7 @@ if (!$running_VDAD) { if ($DB) {print "starting AST_VDauto_dial...\n";} # add a '-L' to the command below to activate logging - `/usr/bin/screen -d -m -S ASTVDauto /home/cron/AST_VDauto_dial.pl`; + `/usr/bin/screen -d -m -S ASTVDauto $PATHhome/AST_VDauto_dial.pl`; } } diff --git a/bin/ADMIN_keepalive_AST_VDremote_agents.pl b/bin/ADMIN_keepalive_AST_VDremote_agents.pl index 5b834222..eb169566 100644 --- a/bin/ADMIN_keepalive_AST_VDremote_agents.pl +++ b/bin/ADMIN_keepalive_AST_VDremote_agents.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# ADMIN_keepalive_AST_VDremote_agents.pl version 0.3 +# ADMIN_keepalive_AST_VDremote_agents.pl version 0.4 # # designed to keep the AST_update processes aline and check every minute # @@ -9,6 +9,7 @@ # # 50810-1453 - removed '-L' flag for screen logging of output (optimization) # 50823-1459 - Added commandline debug options with debug printouts +# 60807-1315 - changed to use /etc/astguiclient.conf for settings # $DB=0; # Debug flag @@ -53,6 +54,27 @@ else } ### end parsing run-time options ### + + +# 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;} + $i++; + } + +$REGhome = $PATHhome; +$REGhome =~ s/\//\\\//gi; + #@psoutput = `ps -f -C AST_update --no-headers`; #@psoutput = `ps -f -C AST_updat* --no-headers`; #@psoutput = `/bin/ps -f --no-headers -A`; @@ -67,7 +89,8 @@ foreach (@psoutput) if ($DBX) {print "$i|$psoutput[$i]| \n";} @psline = split(/\/usr\/bin\/perl /,$psoutput[$i]); -if ($psline[1] =~ /\/home\/cron\/AST_VDremote_agents\.pl/) +#if ($psline[1] =~ /\/home\/cron\/AST_VDremote_agents\.pl/) +if ($psline[1] =~ /$REGhome\/AST_VDremote_agents\.pl/) { $running_VDra++; if ($DB) {print "VDra RUNNING: |$psline[1]|\n";} @@ -94,7 +117,8 @@ foreach (@psoutput2) if ($DBX) {print "$i|$psoutput[$i]| \n";} @psline = split(/\/usr\/bin\/perl /,$psoutput2[$i]); - if ($psline[1] =~ /\/home\/cron\/AST_VDremote_agents\.pl/) +# if ($psline[1] =~ /\/home\/cron\/AST_VDremote_agents\.pl/) + if ($psline[1] =~ /$REGhome\/AST_VDremote_agents\.pl/) { $running_VDra++; if ($DB) {print "VDra RUNNING: |$psline[1]|\n";} @@ -107,7 +131,7 @@ if (!$running_VDra) { if ($DB) {print "starting AST_VDremote_agents...\n";} # add a '-L' to the command below to activate logging - `/usr/bin/screen -d -m -S ASTVDremote /home/cron/AST_VDremote_agents.pl`; + `/usr/bin/screen -d -m -S ASTVDremote $PATHhome/AST_VDremote_agents.pl`; } } diff --git a/bin/ADMIN_keepalive_AST_update.pl b/bin/ADMIN_keepalive_AST_update.pl index 4a713e30..1e0d23dc 100644 --- a/bin/ADMIN_keepalive_AST_update.pl +++ b/bin/ADMIN_keepalive_AST_update.pl @@ -10,6 +10,7 @@ # 50810-1451 - removed '-L' flag for screen logging of output (optimization) # 50823-1446 - Added commandline debug options with debug printouts # 51229-1027 - fixed typo of array name +# 60807-1315 - changed to use /etc/astguiclient.conf for settings # $DB=0; # Debug flag @@ -55,6 +56,25 @@ else ### end parsing run-time options ### +# 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;} + $i++; + } + +$REGhome = $PATHhome; +$REGhome =~ s/\//\\\//gi; + #@psoutput = `ps -f -C AST_update --no-headers`; #@psoutput = `ps -f -C AST_updat* --no-headers`; #@psoutput = `/bin/ps -f --no-headers -A`; @@ -69,7 +89,7 @@ foreach (@psoutput) if ($DBX) {print "$i|$psoutput[$i]| \n";} @psline = split(/\/usr\/bin\/perl /,$psoutput[$i]); -if ($psline[1] =~ /\/home\/cron\/AST_update\.pl/) +if ($psline[1] =~ /$REGhome\/AST_update\.pl/) { $running_update++; if ($DB) {print "UPDATE RUNNING: |$psline[1]|\n";} @@ -96,7 +116,7 @@ foreach (@psoutput2) if ($DBX) {print "$i|$psoutput[$i]| \n";} @psline = split(/\/usr\/bin\/perl /,$psoutput2[$i]); - if ($psline[1] =~ /\/home\/cron\/AST_update\.pl/) + if ($psline[1] =~ /$REGhome\/AST_update\.pl/) { $running_update++; if ($DB) {print "UPDATE RUNNING: |$psline[1]|\n";} @@ -109,7 +129,7 @@ if (!$running_update) { if ($DB) {print "starting AST_update...\n";} # add a '-L' to the command below to activate logging - `/usr/bin/screen -d -m -S ASTupdate /home/cron/AST_update.pl`; + `/usr/bin/screen -d -m -S ASTupdate $PATHhome/AST_update.pl`; } } diff --git a/bin/AST_CRON_mix_recordings_MP3_DATE.pl b/bin/AST_CRON_mix_recordings_MP3_DATE.pl index 5f7ecd95..d926fc2d 100644 --- a/bin/AST_CRON_mix_recordings_MP3_DATE.pl +++ b/bin/AST_CRON_mix_recordings_MP3_DATE.pl @@ -43,6 +43,8 @@ # 51122-1455 - Added soxmix and sox binary path check # 60616-1027 - Modified to convert to MP3 format # - Creates Directory on target FTP server based on . +# 60807-1308 - Modified to use /etc/astguiclient.conf for settings +# #verbose $v=0; @@ -56,8 +58,50 @@ $FTP_pass = 'recordings'; $FTP_dir = '/var/www/html/RECORDINGS'; $FTP_port = '21'; + +# 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 + ### directory where in/out recordings are saved to by Asterisk -$dir1 = '/var/spool/asterisk/monitor'; +$dir1 = "$PATHmonitor"; # get current date in the format YYYYMMDD for use in directory name on the storage server ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); @@ -137,7 +181,7 @@ foreach(@FILES) `$lamebin -b 16 -m m --silent "$dir1/DONE/$ALLfile" "$dir1/DONE/$MP3file"`; - if($DB){print STDERR "\n|/usr/bin/sox $live_folder/$filename[$k]$WAV $arch_folder/$filename[$k]$GSM|\n";} + if($DB){print STDERR "\n|$lamebin -b 16 -m m --silent \"$dir1/DONE/$ALLfile\" \"$dir1/DONE/$MP3file\"\n";} chmod 0755, "$dir1/DONE/$MP3file"; ### BEGIN Remote file transfer