|
@@ -48,7 +48,7 @@ fi
|
|
echo "Maintenance Started"
|
|
echo "Maintenance Started"
|
|
|
|
|
|
if [ .$purge_switch_logs = .true ]; then
|
|
if [ .$purge_switch_logs = .true ]; then
|
|
- #delete freeswitch logs older n days
|
|
|
|
|
|
+ echo "delete freeswitch logs older $days_keep_switch_logs days"
|
|
if [ .$switch_package = .true ]; then
|
|
if [ .$switch_package = .true ]; then
|
|
find /var/log/freeswitch/freeswitch.log.* -mtime +$days_keep_switch_logs -exec rm {} \;
|
|
find /var/log/freeswitch/freeswitch.log.* -mtime +$days_keep_switch_logs -exec rm {} \;
|
|
else
|
|
else
|
|
@@ -59,7 +59,7 @@ else
|
|
fi
|
|
fi
|
|
|
|
|
|
if [ .$purge_fax = .true ]; then
|
|
if [ .$purge_fax = .true ]; then
|
|
- #delete fax older than n days
|
|
|
|
|
|
+ echo "delete fax file storage older than $days_keep_fax days"
|
|
if [ .$switch_package = .true ]; then
|
|
if [ .$switch_package = .true ]; then
|
|
echo ".";
|
|
echo ".";
|
|
find /var/lib/freeswitch/storage/fax/* -name '*.tif' -mtime +$days_keep_fax -exec rm {} \;
|
|
find /var/lib/freeswitch/storage/fax/* -name '*.tif' -mtime +$days_keep_fax -exec rm {} \;
|
|
@@ -77,7 +77,7 @@ else
|
|
fi
|
|
fi
|
|
|
|
|
|
if [ .$purge_call_recordings = .true ]; then
|
|
if [ .$purge_call_recordings = .true ]; then
|
|
- #delete call recordings older than n days
|
|
|
|
|
|
+ echo "delete call recordings older than $days_keep_call_recordings days"
|
|
if [ .$switch_package = .true ]; then
|
|
if [ .$switch_package = .true ]; then
|
|
find /var/lib/freeswitch/recordings/*/archive/* -name '*.wav' -mtime +$days_keep_call_recordings -exec rm {} \;
|
|
find /var/lib/freeswitch/recordings/*/archive/* -name '*.wav' -mtime +$days_keep_call_recordings -exec rm {} \;
|
|
find /var/lib/freeswitch/recordings/*/archive/* -name '*.mp3' -mtime +$days_keep_call_recordings -exec rm {} \;
|
|
find /var/lib/freeswitch/recordings/*/archive/* -name '*.mp3' -mtime +$days_keep_call_recordings -exec rm {} \;
|
|
@@ -96,7 +96,7 @@ else
|
|
fi
|
|
fi
|
|
|
|
|
|
if [ .$purge_voicemail = .true ]; then
|
|
if [ .$purge_voicemail = .true ]; then
|
|
- #delete voicemail older than n days
|
|
|
|
|
|
+ echo "delete voicemail older than $days_keep_voicemail days"
|
|
if [ .$switch_package = .true ]; then
|
|
if [ .$switch_package = .true ]; then
|
|
echo ".";
|
|
echo ".";
|
|
find /var/lib/freeswitch/storage/voicemail/default/* -name 'msg_*.wav' -mtime +$days_keep_voicemail -exec rm {} \;
|
|
find /var/lib/freeswitch/storage/voicemail/default/* -name 'msg_*.wav' -mtime +$days_keep_voicemail -exec rm {} \;
|
|
@@ -112,61 +112,61 @@ else
|
|
fi
|
|
fi
|
|
|
|
|
|
if [ .$purge_cdrs = .true ]; then
|
|
if [ .$purge_cdrs = .true ]; then
|
|
- #delete call detail records older n days
|
|
|
|
|
|
+ echo "delete call detail records older $days_keep_cdrs days"
|
|
psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_xml_cdr WHERE start_stamp < NOW() - INTERVAL '$days_keep_cdrs days'"
|
|
psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_xml_cdr WHERE start_stamp < NOW() - INTERVAL '$days_keep_cdrs days'"
|
|
#call detail record - call flow
|
|
#call detail record - call flow
|
|
psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_xml_cdr_flow WHERE insert_date < NOW() - INTERVAL '$days_keep_cdrs days'"
|
|
psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_xml_cdr_flow WHERE insert_date < NOW() - INTERVAL '$days_keep_cdrs days'"
|
|
#call detail record - json
|
|
#call detail record - json
|
|
psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_xml_cdr_json WHERE start_stamp < NOW() - INTERVAL '$days_keep_cdrs days'"
|
|
psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_xml_cdr_json WHERE start_stamp < NOW() - INTERVAL '$days_keep_cdrs days'"
|
|
#call detail record - call logs
|
|
#call detail record - call logs
|
|
- psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_xml_cdr_logs WHERE log_date < NOW() - INTERVAL '$days_keep_cdrs days'"
|
|
|
|
|
|
+ psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_xml_cdr_logs WHERE insert_date < NOW() - INTERVAL '$days_keep_cdrs days'"
|
|
else
|
|
else
|
|
echo "not purging CDRs."
|
|
echo "not purging CDRs."
|
|
fi
|
|
fi
|
|
|
|
|
|
-#delete php sessions
|
|
|
|
|
|
+echo "delete php sessions older than $days_keep_php_sessions days"
|
|
if [ .$purge_php_sessions = .true ]; then
|
|
if [ .$purge_php_sessions = .true ]; then
|
|
find /var/lib/php/sessions/* -name 'sess_*' -mtime +$days_keep_php_sessions -exec rm {} \;
|
|
find /var/lib/php/sessions/* -name 'sess_*' -mtime +$days_keep_php_sessions -exec rm {} \;
|
|
else
|
|
else
|
|
echo "not purging PHP Sessions."
|
|
echo "not purging PHP Sessions."
|
|
fi
|
|
fi
|
|
|
|
|
|
-#delete database_transactions older n days
|
|
|
|
|
|
+echo "delete database_transactions older $days_keep_database_transactions days"
|
|
if [ .$purge_database_transactions = .true ]; then
|
|
if [ .$purge_database_transactions = .true ]; then
|
|
psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_database_transactions where transaction_date < NOW() - INTERVAL '$days_keep_database_transactions days'"
|
|
psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_database_transactions where transaction_date < NOW() - INTERVAL '$days_keep_database_transactions days'"
|
|
else
|
|
else
|
|
echo "not purging database_transactions."
|
|
echo "not purging database_transactions."
|
|
fi
|
|
fi
|
|
|
|
|
|
-#delete device_logs older n days
|
|
|
|
|
|
+echo "delete device_logs older $days_keep_device_logs days"
|
|
if [ .$purge_device_logs = .true ]; then
|
|
if [ .$purge_device_logs = .true ]; then
|
|
psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_device_logs where timestamp < NOW() - INTERVAL '$days_keep_device_logs days'"
|
|
psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_device_logs where timestamp < NOW() - INTERVAL '$days_keep_device_logs days'"
|
|
else
|
|
else
|
|
echo "not purging device_logs."
|
|
echo "not purging device_logs."
|
|
fi
|
|
fi
|
|
|
|
|
|
-#delete event_guard_logs older n days
|
|
|
|
|
|
+echo "delete event_guard_logs older $days_keep_event_guard_logs days"
|
|
if [ .$purge_event_guard_logs = .true ]; then
|
|
if [ .$purge_event_guard_logs = .true ]; then
|
|
- psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_event_guard_logs where timestamp < NOW() - INTERVAL '$days_keep_event_guard_logs days'"
|
|
|
|
|
|
+ psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_event_guard_logs where log_date < NOW() - INTERVAL '$days_keep_event_guard_logs days'"
|
|
else
|
|
else
|
|
echo "not purging event_guard_logs."
|
|
echo "not purging event_guard_logs."
|
|
fi
|
|
fi
|
|
|
|
|
|
-#delete user_logs older n days
|
|
|
|
-if [ .$days_keep_event_guard_logs = .true ]; then
|
|
|
|
|
|
+echo "delete user_logs older $days_keep_user_logs days"
|
|
|
|
+if [ .$purge_user_logs = .true ]; then
|
|
psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_user_logs where timestamp < NOW() - INTERVAL '$days_keep_user_logs days'"
|
|
psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_user_logs where timestamp < NOW() - INTERVAL '$days_keep_user_logs days'"
|
|
else
|
|
else
|
|
echo "not purging user_logs."
|
|
echo "not purging user_logs."
|
|
fi
|
|
fi
|
|
|
|
|
|
-#delete email_queue older n days
|
|
|
|
|
|
+echo "delete email_queue older $days_keep_email_queue days"
|
|
if [ .$purge_email_queue = .true ]; then
|
|
if [ .$purge_email_queue = .true ]; then
|
|
psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_email_queue where email_status = 'sent' and email_date < NOW() - INTERVAL '$days_keep_email_queue days'"
|
|
psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_email_queue where email_status = 'sent' and email_date < NOW() - INTERVAL '$days_keep_email_queue days'"
|
|
else
|
|
else
|
|
echo "not purging email_queue."
|
|
echo "not purging email_queue."
|
|
fi
|
|
fi
|
|
|
|
|
|
-#delete fax_queue older n days
|
|
|
|
|
|
+echo "delete fax_queue older $days_keep_fax_queue days"
|
|
if [ .$purge_fax_queue = .true ]; then
|
|
if [ .$purge_fax_queue = .true ]; then
|
|
psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_fax_queue where fax_status = 'sent' and fax_date < NOW() - INTERVAL '$days_keep_fax_queue days'"
|
|
psql $db_name --port $db_port --host=$db_host --username=$db_username -c "delete from v_fax_queue where fax_status = 'sent' and fax_date < NOW() - INTERVAL '$days_keep_fax_queue days'"
|
|
else
|
|
else
|