From ce160c506c6c153455d84c24dcb9ee360a29dc07 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Fri, 24 Jun 2022 07:13:09 +0000 Subject: [PATCH] Add a process date for the output filename when loading serials. Change the write method to append. #684 --- utils/load_warranty_serial/bulk_load_serials.php | 2 +- utils/warranty_motiv_local_bulk.sh | 7 +++++-- utils/warranty_motiv_prod_bulk.sh | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/utils/load_warranty_serial/bulk_load_serials.php b/utils/load_warranty_serial/bulk_load_serials.php index bfdd547a..cc68f0ab 100644 --- a/utils/load_warranty_serial/bulk_load_serials.php +++ b/utils/load_warranty_serial/bulk_load_serials.php @@ -10,7 +10,7 @@ use Symfony\Component\Dotenv\Dotenv; $csv = fopen($argv[1], 'r'); $output_file = $argv[2]; -$output_fh = fopen($output_file, "w"); +$output_fh = fopen($output_file, "a"); if (!file_exists($argv[1])) { diff --git a/utils/warranty_motiv_local_bulk.sh b/utils/warranty_motiv_local_bulk.sh index 44425c4f..f47e31a1 100755 --- a/utils/warranty_motiv_local_bulk.sh +++ b/utils/warranty_motiv_local_bulk.sh @@ -1,4 +1,6 @@ #!/bin/bash +proc_date=`date +%m-%d-%y` +load_status_file="/tmp/warranty_load_status_$proc_date.txt" touch /tmp/warranty_download_serial.csv /usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 04-01-22 /tmp/warranty_download_serial.csv 1 /usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 04-02-22 /tmp/warranty_download_serial.csv 0 @@ -83,5 +85,6 @@ touch /tmp/warranty_download_serial.csv /usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-20-22 /tmp/warranty_download_serial.csv 0 /usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-21-22 /tmp/warranty_download_serial.csv 0 /usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-22-22 /tmp/warranty_download_serial.csv 0 -touch /tmp/warranty_load_status.txt -/usr/bin/php /var/www/resq/utils/load_warranty_serial/bulk_load_serials.php /tmp/warranty_download_serial.csv /tmp/warranty_load_status.txt +/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-23-22 /tmp/warranty_download_serial.csv 0 +touch $load_status_file +/usr/bin/php /var/www/resq/utils/load_warranty_serial/bulk_load_serials.php /tmp/warranty_download_serial.csv $load_status_file diff --git a/utils/warranty_motiv_prod_bulk.sh b/utils/warranty_motiv_prod_bulk.sh index 44425c4f..f47e31a1 100755 --- a/utils/warranty_motiv_prod_bulk.sh +++ b/utils/warranty_motiv_prod_bulk.sh @@ -1,4 +1,6 @@ #!/bin/bash +proc_date=`date +%m-%d-%y` +load_status_file="/tmp/warranty_load_status_$proc_date.txt" touch /tmp/warranty_download_serial.csv /usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 04-01-22 /tmp/warranty_download_serial.csv 1 /usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 04-02-22 /tmp/warranty_download_serial.csv 0 @@ -83,5 +85,6 @@ touch /tmp/warranty_download_serial.csv /usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-20-22 /tmp/warranty_download_serial.csv 0 /usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-21-22 /tmp/warranty_download_serial.csv 0 /usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-22-22 /tmp/warranty_download_serial.csv 0 -touch /tmp/warranty_load_status.txt -/usr/bin/php /var/www/resq/utils/load_warranty_serial/bulk_load_serials.php /tmp/warranty_download_serial.csv /tmp/warranty_load_status.txt +/usr/bin/php /var/www/resq/utils/get_warranty_serial/new_get_serials.php 06-23-22 /tmp/warranty_download_serial.csv 0 +touch $load_status_file +/usr/bin/php /var/www/resq/utils/load_warranty_serial/bulk_load_serials.php /tmp/warranty_download_serial.csv $load_status_file