From f023f1d59afccea79a364836977ed0d8a8dc0cec Mon Sep 17 00:00:00 2001 From: mattf Date: Wed, 11 Oct 2017 03:16:27 +0000 Subject: [PATCH] Added process debug with --DebugXXX flag and screen logging for main processes and screenlog rolling git-svn-id: svn://192.168.202.10@2837 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl | 86 ++++++++++++++++---- agc_2-X/trunk/bin/ADMIN_restart_roll_logs.pl | 46 ++++++++++- 2 files changed, 115 insertions(+), 17 deletions(-) diff --git a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl index 8e75b1da..99c2add5 100644 --- a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl +++ b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl @@ -124,9 +124,10 @@ # 170816-2323 - Added In-Group Ask-Post-Call Survey AGI dialplan entries # 170916-1009 - Added Asterisk 13 'h' exten for dialplan generation and triggering of AMI2 scripts # 170920-2214 - Added expired_lists_inactive option, checks once per hour +# 171010-2254 - Added process debug with --DebugXXX flag and screen logging # -$build = '170920-2214'; +$build = '171010-2254'; $DB=0; # Debug flag $teodDB=0; # flag to log Timeclock End of Day processes to log file @@ -221,7 +222,7 @@ if (length($ARGV[0])>1) print " [-cu3way-delay=X] = setting delay seconds on 3way conference checker\n"; print " [-debug] = verbose debug messages\n"; print " [-debugX] = Extra-verbose debug messages\n"; - print " [-debugXXX] = Triple-Extra-verbose debug messages\n"; + print " [-debugXXX] = Triple-Extra-verbose debug messages, debug flag on processes and screen logging\n"; print " [--teod] = log Timeclock End of Day processes to log file\n"; print "\n"; exit; @@ -245,6 +246,8 @@ if (length($ARGV[0])>1) if ($args =~ /-debugXXX/i) { $DBXXX=1; + $megaDB=1; + $debug_string = '--debugX'; print "\n----- TRIPLE DEBUGGING -----\n\n"; } if ($args =~ /-teod/i) @@ -781,65 +784,113 @@ else if ($DB) {print "starting AST_update...\n";} # add a '-L' to the command below to activate logging if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} >= 12)) - {`/usr/bin/screen -d -m -S ASTupdate $PATHhome/AST_update_AMI2.pl`;} + { + `/usr/bin/screen -d -m -S ASTupdate $PATHhome/AST_update_AMI2.pl $debug_string`; + } else - {`/usr/bin/screen -d -m -S ASTupdate $PATHhome/AST_update.pl`;} + {`/usr/bin/screen -d -m -S ASTupdate $PATHhome/AST_update.pl $debug_string`;} + + if ($megaDB) + { + `/usr/bin/screen -S ASTupdate -X logfile $PATHlogs/ASTupdate-screenlog.0`; + `/usr/bin/screen -S ASTupdate -X log`; + } } if ( ($AST_send_listen > 0) && ($runningAST_send < 1) ) { if ($DB) {print "starting AST_manager_send...\n";} # add a '-L' to the command below to activate logging - `/usr/bin/screen -d -m -S ASTsend $PATHhome/AST_manager_send.pl`; + `/usr/bin/screen -d -m -S ASTsend $PATHhome/AST_manager_send.pl $debug_string`; + if ($megaDB) + { + `/usr/bin/screen -S ASTsend -X logfile $PATHlogs/ASTsend-screenlog.0`; + `/usr/bin/screen -S ASTsend -X log`; + } } if ( ($AST_send_listen > 0) && ($runningAST_listen < 1) ) { if ($DB) {print "starting AST_manager_listen...\n";} # add a '-L' to the command below to activate logging if (( $ast_ver_str{major} = 1 ) && ($ast_ver_str{minor} >= 12)) - {`/usr/bin/screen -d -m -S ASTlisten $PATHhome/AST_manager_listen_AMI2.pl`;} + {`/usr/bin/screen -d -m -S ASTlisten $PATHhome/AST_manager_listen_AMI2.pl $debug_string`;} else { if ($lstn_buffer > 0) - {`/usr/bin/screen -d -m -S ASTlisten $PATHhome/AST_manager_listenBUFFER.pl`;} + {`/usr/bin/screen -d -m -S ASTlisten $PATHhome/AST_manager_listenBUFFER.pl $debug_string`;} else - {`/usr/bin/screen -d -m -S ASTlisten $PATHhome/AST_manager_listen.pl`;} + {`/usr/bin/screen -d -m -S ASTlisten $PATHhome/AST_manager_listen.pl $debug_string`;} + } + if ($megaDB) + { + `/usr/bin/screen -S ASTlisten -X logfile $PATHlogs/ASTlisten-screenlog.0`; + `/usr/bin/screen -S ASTlisten -X log`; } } if ( ($AST_VDauto_dial > 0) && ($runningAST_VDauto_dial < 1) ) { 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 $PATHhome/AST_VDauto_dial.pl $autodial_delay`; + `/usr/bin/screen -d -m -S ASTVDauto $PATHhome/AST_VDauto_dial.pl $debug_string $autodial_delay`; + if ($megaDB) + { + `/usr/bin/screen -S ASTVDauto -X logfile $PATHlogs/ASTVDauto-screenlog.0`; + `/usr/bin/screen -S ASTVDauto -X log`; + } } if ( ($AST_VDremote_agents > 0) && ($runningAST_VDremote_agents < 1) ) { 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 $PATHhome/AST_VDremote_agents.pl --debug`; + `/usr/bin/screen -d -m -S ASTVDremote $PATHhome/AST_VDremote_agents.pl --debug $debug_string`; + if ($megaDB) + { + `/usr/bin/screen -S ASTVDremote -X logfile $PATHlogs/ASTVDremote-screenlog.0`; + `/usr/bin/screen -S ASTVDremote -X log`; + } } if ( ($AST_VDadapt > 0) && ($runningAST_VDadapt < 1) ) { if ($DB) {print "starting AST_VDadapt...\n";} # add a '-L' to the command below to activate logging - `/usr/bin/screen -d -m -S ASTVDadapt $PATHhome/AST_VDadapt.pl --debug`; + `/usr/bin/screen -d -m -S ASTVDadapt $PATHhome/AST_VDadapt.pl --debug $debug_string`; + if ($megaDB) + { + `/usr/bin/screen -S ASTVDadapt -X logfile $PATHlogs/ASTVDadapt-screenlog.0`; + `/usr/bin/screen -S ASTVDadapt -X log`; + } } if ( ($FastAGI_log > 0) && ($runningFastAGI_log < 1) ) { if ($DB) {print "starting FastAGI_log...\n";} # add a '-L' to the command below to activate logging - `/usr/bin/screen -d -m -S ASTfastlog $PATHhome/FastAGI_log.pl --debug`; + `/usr/bin/screen -d -m -S ASTfastlog $PATHhome/FastAGI_log.pl --debug $debug_string`; + if ($megaDB) + { + `/usr/bin/screen -S ASTfastlog -X logfile $PATHlogs/ASTfastlog-screenlog.0`; + `/usr/bin/screen -S ASTfastlog -X log`; + } } if ( ($AST_VDauto_dial_FILL > 0) && ($runningAST_VDauto_dial_FILL < 1) ) { if ($DB) {print "starting AST_VDauto_dial_FILL...\n";} # add a '-L' to the command below to activate logging - `/usr/bin/screen -d -m -S ASTVDadFILL $PATHhome/AST_VDauto_dial_FILL.pl --debug $fill_staggered $adfill_delay`; + `/usr/bin/screen -d -m -S ASTVDadFILL $PATHhome/AST_VDauto_dial_FILL.pl --debug $fill_staggered $adfill_delay $debug_string`; + if ($megaDB) + { + `/usr/bin/screen -S ASTadFILL -X logfile $PATHlogs/ASTadFILL-screenlog.0`; + `/usr/bin/screen -S ASTadFILL -X log`; + } } if ( ($email_inbound > 0) && ($runningemail_inbound < 1) ) { if ($DB) {print "starting VD_email_inbound...\n";} # add a '-L' to the command below to activate logging - `/usr/bin/screen -d -m -S ASTemail $PATHhome/VD_email_inbound.pl`; + `/usr/bin/screen -d -m -S ASTemail $PATHhome/VD_email_inbound.pl $debug_string`; + if ($megaDB) + { + `/usr/bin/screen -S ASTemail -X logfile $PATHlogs/ASTemail-screenlog.0`; + `/usr/bin/screen -S ASTemail -X log`; + } } if ( ($ip_relay > 0) && ($runningip_relay < 1) ) { @@ -850,7 +901,12 @@ else { if ($DB) {print "starting AST_conf_3way...\n";} # add a '-L' to the command below to activate logging - `/usr/bin/screen -d -m -S ASTconf3way $PATHhome/AST_conf_update_3way.pl --debug $cu3way_delay`; + `/usr/bin/screen -d -m -S ASTconf3way $PATHhome/AST_conf_update_3way.pl --debug $cu3way_delay $debug_string`; + if ($megaDB) + { + `/usr/bin/screen -S ASTconf3way -X logfile $PATHlogs/ASTconf3way-screenlog.0`; + `/usr/bin/screen -S ASTconf3way -X log`; + } } } } diff --git a/agc_2-X/trunk/bin/ADMIN_restart_roll_logs.pl b/agc_2-X/trunk/bin/ADMIN_restart_roll_logs.pl index 917618b8..985b1567 100644 --- a/agc_2-X/trunk/bin/ADMIN_restart_roll_logs.pl +++ b/agc_2-X/trunk/bin/ADMIN_restart_roll_logs.pl @@ -1,12 +1,12 @@ #!/usr/bin/perl # -# ADMIN_restart_roll_logs.pl version 2.12 +# ADMIN_restart_roll_logs.pl version 2.14 # # script to roll the Asterisk logs on machine restart # # have this run on the astersik server # -# Copyright (C) 2015 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2017 Matt Florell LICENSE: AGPLv2 # # CHANGES: # 90311-0921 - Added /var/log/asterisk/screenlog log rolling @@ -14,6 +14,7 @@ # 130108-1715 - Changes for new log rolling script compatibility # 141124-2309 - Fixed Fhour variable bug # 151110-2005 - Added rolling of Asterisk cdr.db +# 171010-2258 - Added rolling of proccess screenlogs # ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); @@ -73,6 +74,47 @@ if ( -e '/var/log/asterisk/screenlog.0' ) `mv -f /var/log/asterisk/screenlog.0 /var/log/asterisk/screenlog.0.asterisk.$now_date`; } +print "rolling Vicidial screen logs...\n"; +if ( -e '/var/log/astguiclient/ASTVDauto-screenlog.0' ) + { + `mv -f /var/log/astguiclient/ASTVDauto-screenlog.0 /var/log/astguiclient/ASTVDauto-screenlog.0.$now_date`; + } +if ( -e '/var/log/astguiclient/ASTVDremote-screenlog.0' ) + { + `mv -f /var/log/astguiclient/ASTVDremote-screenlog.0 /var/log/astguiclient/ASTVDremote-screenlog.0.$now_date`; + } +if ( -e '/var/log/astguiclient/ASTfastlog-screenlog.0' ) + { + `mv -f /var/log/astguiclient/ASTfastlog-screenlog.0 /var/log/astguiclient/ASTfastlog-screenlog.0.$now_date`; + } +if ( -e '/var/log/astguiclient/ASTlisten-screenlog.0' ) + { + `mv -f /var/log/astguiclient/ASTlisten-screenlog.0 /var/log/astguiclient/ASTlisten-screenlog.0.$now_date`; + } +if ( -e '/var/log/astguiclient/ASTsend-screenlog.0' ) + { + `mv -f /var/log/astguiclient/ASTsend-screenlog.0 /var/log/astguiclient/ASTsend-screenlog.0.$now_date`; + } +if ( -e '/var/log/astguiclient/ASTadFILL-screenlog.0' ) + { + `mv -f /var/log/astguiclient/ASTadFILL-screenlog.0 /var/log/astguiclient/ASTadFILL-screenlog.0.$now_date`; + } +if ( -e '/var/log/astguiclient/ASTemail-screenlog.0' ) + { + `mv -f /var/log/astguiclient/ASTemail-screenlog.0 /var/log/astguiclient/ASTemail-screenlog.0.$now_date`; + } +if ( -e '/var/log/astguiclient/ASTconf3way-screenlog.0' ) + { + `mv -f /var/log/astguiclient/ASTconf3way-screenlog.0 /var/log/astguiclient/ASTconf3way-screenlog.0.$now_date`; + } +if ( -e '/var/log/astguiclient/ASTupdate-screenlog.0' ) + { + `mv -f /var/log/astguiclient/ASTupdate-screenlog.0 /var/log/astguiclient/ASTupdate-screenlog.0.$now_date`; + } +if ( -e '/var/log/astguiclient/ASTadpat-screenlog.0' ) + { + `mv -f /var/log/astguiclient/ASTVDadapt-screenlog.0 /var/log/astguiclient/ASTVDadapt-screenlog.0.$now_date`; + } print "FINISHED... EXITING\n";