From 92809d8c1606b24c24951ca8535a1fa0649f3f51 Mon Sep 17 00:00:00 2001 From: Eliezer Croitoru Date: Sun, 18 Jul 2021 18:06:01 +0300 Subject: [PATCH] 32 --- gen-cron-line.sh | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/gen-cron-line.sh b/gen-cron-line.sh index 157a978..007ae0f 100755 --- a/gen-cron-line.sh +++ b/gen-cron-line.sh @@ -6,23 +6,42 @@ DST_DOMAIN_LIST_URL=$(head -1 dst-domain-url) APP_NAME="NgTechBypassDstDomain" SCRIPT_PATH="/storage/cron-example-with-diff-dstdom.sh" -echo "####" -echo +export CA_CERT_BUNDLE_PATH="/pfrm2.0/opt/fw1/bin/ca-bundle.crt" +export SSL_CERT_FILE="${CA_CERT_BUNDLE_PATH}" +alias curl_cli="curl_cli --cacert ${CA_CERT_BUNDLE_PATH}" -echo "*/5 * * * * /usr/bin/wget -q ${SCRIPT_URL} -O ${SCRIPT_PATH} >/dev/null 2>&1 && /usr/bin/md5sum ${SCRIPT_PATH} |/bin/grep \"^${SCRIPT_MD5_SUM} \" && /bin/bash ${SCRIPT_PATH} ${APP_NAME} ${DST_DOMAIN_LIST_URL} >/dev/null 2>&1" echo "####" echo +SCRIPT_TMP_PATH="/tmp/cron-example-with-diff-dstdom.sh_73ffe3f6-b85a-46ed-9e11-07865339759c" +echo "*/5 * * * * /usr/bin/md5sum ${SCRIPT_PATH} | /bin/grep \"^${SCRIPT_MD5_SUM} \" || curl_cli --cacert ${CA_CERT_BUNDLE_PATH} -s ${SCRIPT_URL} -o ${SCRIPT_TMP_PATH} >/dev/null 2>&1 && /usr/bin/md5sum ${SCRIPT_TMP_PATH} |/bin/grep \"^${SCRIPT_MD5_SUM} \" && mv ${SCRIPT_TMP_PATH} ${SCRIPT_PATH}" + + +echo "####" +echo +echo "*/5 * * * * /bin/bash ${SCRIPT_PATH} ${APP_NAME} ${DST_DOMAIN_LIST_URL} >/dev/null 2>&1" + +echo "####" +echo + + DST_DOMAIN_LIST_URL=$(head -1 block-list-dst-domain-url) APP_NAME="NgTechBlockListDstDomain" -echo "*/1 * * * * /usr/bin/wget -q ${SCRIPT_URL} -O ${SCRIPT_PATH} >/dev/null 2>&1 && /usr/bin/md5sum ${SCRIPT_PATH} |/bin/grep \"^${SCRIPT_MD5_SUM} \" && /bin/bash ${SCRIPT_PATH} ${APP_NAME} ${DST_DOMAIN_LIST_URL} >/dev/null 2>&1" +echo "*/1 * * * * bin/bash ${SCRIPT_PATH} ${APP_NAME} ${DST_DOMAIN_LIST_URL} >/dev/null 2>&1" + SCRIPT_MD5_SUM=$(md5sum collect-clish-scripts.sh|awk '{print $1}') SCRIPT_URL="https://raw.githubusercontent.com/elico/cp-tls-inspection-application-update-cron/master/collect-clish-scripts.sh" SCRIPT_PATH="/storage/collect-clish-scripts.sh" +SCRIPT_TMP_PATH="/tmp/collect-clish-scripts.sh_73ffe3f6-b85a-46ed-9e11-07865339759c" echo "####" echo -echo "*/30 * * * * /usr/bin/wget -q ${SCRIPT_URL} -O ${SCRIPT_PATH} >/dev/null 2>&1 && /usr/bin/md5sum ${SCRIPT_PATH} |/bin/grep \"^${SCRIPT_MD5_SUM} \" && /bin/bash ${SCRIPT_PATH} >/dev/null 2>&1" +echo "*/5 * * * * /usr/bin/md5sum ${SCRIPT_PATH} | /bin/grep \"^${SCRIPT_MD5_SUM} \" || curl_cli --cacert ${CA_CERT_BUNDLE_PATH} -s ${SCRIPT_URL} -o ${SCRIPT_TMP_PATH} >/dev/null 2>&1 && /usr/bin/md5sum ${SCRIPT_TMP_PATH} |/bin/grep \"^${SCRIPT_MD5_SUM} \" && mv ${SCRIPT_TMP_PATH} ${SCRIPT_PATH}" + +echo "####" +echo + +echo "*/30 * * * * /bin/bash ${SCRIPT_PATH} >/dev/null 2>&1"