From 2d8bdbbc414c0ff8d4f1afd23f943aa326ecd46c Mon Sep 17 00:00:00 2001 From: Eliezer Croitoru Date: Wed, 14 Jul 2021 15:11:52 +0300 Subject: [PATCH] 11 --- README.md | 14 +++++++++++++- cron-example-with-diff-dstdom.sh | 2 +- gen-cron-line.sh | 9 +++++++++ gen-update-script.sh | 12 ++++++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100755 gen-cron-line.sh create mode 100755 gen-update-script.sh diff --git a/README.md b/README.md index 95b2941..cb8c7a7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ # Example of a crontab job -```*/10 * * * * wget -q https://raw.githubusercontent.com/elico/cp-tls-inspection-application-update-cron/master/cron-example-with-diff-dstdom.sh -O /storage/cron-example-with-diff-dstdom.sh >/dev/null 2>&1 && md5sum /storage/cron-example-with-diff-dstdom.sh |grep "^abd059721f467572a4de49cbf5bc7024 " && bash /storage/cron-example-with-diff-dstdom.sh test https://gist.githubusercontent.com/elico/249034a199d17ce52524f47fad49964f/raw/bdd95d87232f8173185acc14540d58bfb2c9ff79/010-GeneralTLSInspectionBypass.dstdom >/dev/null 2>&1``` +``` +*/10 * * * * wget -q https://raw.githubusercontent.com/elico/cp-tls-inspection-application-update-cron/master/cron-example-with-diff-dstdom.sh -O /storage/cron-example-with-diff-dstdom.sh >/dev/null 2>&1 && md5sum /storage/cron-example-with-diff-dstdom.sh |grep "^aaf096ee1b0b946f7be4d29186902bfb " && bash /storage/cron-example-with-diff-dstdom.sh NgTechBypassDstDomain https://gist.githubusercontent.com/elico/249034a199d17ce52524f47fad49964f/raw/bdd95d87232f8173185acc14540d58bfb2c9ff79/010-GeneralTLSInspectionBypass.dstdom >/dev/null 2>&1 +``` + +# Example of update bash script + +```bash +#!/usr/bin/env bash +wget https://raw.githubusercontent.com/elico/cp-tls-inspection-application-update-cron/master/cron-example-with-diff-dstdom.sh \ + -O /storage/cron-example-with-diff-dstdom.sh && \ + md5sum /storage/cron-example-with-diff-dstdom.sh | grep "^aaf096ee1b0b946f7be4d29186902bfb " && \ + bash /storage/cron-example-with-diff-dstdom.sh NgTechBypassDstDomain https://gist.githubusercontent.com/elico/249034a199d17ce52524f47fad49964f/raw/bdd95d87232f8173185acc14540d58bfb2c9ff79/010-GeneralTLSInspectionBypass.dstdom +``` diff --git a/cron-example-with-diff-dstdom.sh b/cron-example-with-diff-dstdom.sh index 5383046..2571ac5 100755 --- a/cron-example-with-diff-dstdom.sh +++ b/cron-example-with-diff-dstdom.sh @@ -199,4 +199,4 @@ else echo "${TMP_CLISH_TRANSACTION_FILE}" fi -rm -fv "${LOCK_FILE" +rm -fv "${LOCK_FILE}" diff --git a/gen-cron-line.sh b/gen-cron-line.sh new file mode 100755 index 0000000..bca50ad --- /dev/null +++ b/gen-cron-line.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +SCRIPT_MD5_SUM=$(md5sum cron-example-with-diff-dstdom.sh|awk '{print $1}') +SCRIPT_URL="https://raw.githubusercontent.com/elico/cp-tls-inspection-application-update-cron/master/cron-example-with-diff-dstdom.sh" +DST_DOMAIN_LIST_URL="https://gist.githubusercontent.com/elico/249034a199d17ce52524f47fad49964f/raw/bdd95d87232f8173185acc14540d58bfb2c9ff79/010-GeneralTLSInspectionBypass.dstdom" +APP_NAME="NgTechBypassDstDomain" +SCRIPT_PATH="/storage/cron-example-with-diff-dstdom.sh" + +echo "*/10 * * * * wget -q ${SCRIPT_URL} -O ${SCRIPT_PATH} >/dev/null 2>&1 && md5sum ${SCRIPT_PATH} |grep \"^${SCRIPT_MD5_SUM} \" && bash ${SCRIPT_PATH} ${APP_NAME} ${DST_DOMAIN_LIST_URL} >/dev/null 2>&1" diff --git a/gen-update-script.sh b/gen-update-script.sh new file mode 100755 index 0000000..fe367f2 --- /dev/null +++ b/gen-update-script.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +SCRIPT_MD5_SUM=$(md5sum cron-example-with-diff-dstdom.sh|awk '{print $1}') +SCRIPT_URL="https://raw.githubusercontent.com/elico/cp-tls-inspection-application-update-cron/master/cron-example-with-diff-dstdom.sh" +DST_DOMAIN_LIST_URL="https://gist.githubusercontent.com/elico/249034a199d17ce52524f47fad49964f/raw/bdd95d87232f8173185acc14540d58bfb2c9ff79/010-GeneralTLSInspectionBypass.dstdom" +APP_NAME="NgTechBypassDstDomain" +SCRIPT_PATH="/storage/cron-example-with-diff-dstdom.sh" + +echo -e "#!/usr/bin/env bash\nwget ${SCRIPT_URL} \\ + -O ${SCRIPT_PATH} && \\ + md5sum ${SCRIPT_PATH} | grep \"^${SCRIPT_MD5_SUM} \" && \\ + bash ${SCRIPT_PATH} ${APP_NAME} ${DST_DOMAIN_LIST_URL}"