From e18453a8fd2007c576366db336bba47a05b370ab Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Mon, 23 Jun 2014 15:18:08 +0200 Subject: [PATCH] MT#6659 Add check of basic files avialability (cherry picked from commit 08819aaa84e65bf3dc253e8e8d574dc61ad80e99) --- ce/03_files_availability.sh | 31 +++++++++++++++++++++++++++++++ pro/03_files_availability.sh | 1 + 2 files changed, 32 insertions(+) create mode 100755 ce/03_files_availability.sh create mode 120000 pro/03_files_availability.sh diff --git a/ce/03_files_availability.sh b/ce/03_files_availability.sh new file mode 100755 index 0000000..506e34f --- /dev/null +++ b/ce/03_files_availability.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +i=1 +declare -a FILES=( "/etc/ngcp_version" \ + "/etc/sipwise_ngcp_version" \ + "/etc/apt/sources.list.d/sipwise.list" \ + "/etc/ngcp-config/config.yml" \ + "/etc/ngcp-config/constants.yml" \ + "/etc/ngcp-config/network.yml" \ + ) + +echo "1..$(( 2 *${#FILES[@]} ))" + +for FILE in "${FILES[@]}" ; do + + if [ -f ${FILE} ]; then + echo "ok $i - Found file: ${FILE}" + else + echo "not ok $i - File not found: ${FILE}" + fi + i=$(($i+1)) + + COUNT=$(stat -c%s ${FILE} 2>/dev/null || echo 0) + if [ "$COUNT" != "0" ]; then + echo "ok $i - File is not empty: ${FILE}" + else + echo "not ok $i - File is empty: ${FILE}" + fi + i=$(($i+1)) + +done diff --git a/pro/03_files_availability.sh b/pro/03_files_availability.sh new file mode 120000 index 0000000..68828e2 --- /dev/null +++ b/pro/03_files_availability.sh @@ -0,0 +1 @@ +../ce/03_files_availability.sh \ No newline at end of file