mirror of
https://github.com/willfarrell/docker-crontab.git
synced 2025-04-04 14:05:11 +02:00
add comments to scripts
This commit is contained in:
parent
8f787586e7
commit
c4a114a31c
@ -131,12 +131,18 @@ function build_crontab() {
|
||||
continue
|
||||
fi
|
||||
|
||||
COMMENT=$(jq -r .[$i].comment ${CONFIG})
|
||||
if [ "${COMMENT}" != "null" ]; then
|
||||
echo "# ${COMMENT}" >> ${CRONTAB_FILE}
|
||||
fi
|
||||
|
||||
SCRIPT_NAME=$(cat /proc/sys/kernel/random/uuid)
|
||||
COMMAND="/bin/bash ${HOME_DIR}/jobs/${SCRIPT_NAME}.sh"
|
||||
cat << EOF > ${HOME_DIR}/jobs/${SCRIPT_NAME}.sh
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
echo "cron: ${COMMENT}"
|
||||
$(make_cmd "$(jq -c .[$i] ${CONFIG})")
|
||||
EOF
|
||||
if [ "$(jq -r .[$i].trigger ${CONFIG})" != "null" ]; then
|
||||
@ -151,14 +157,6 @@ EOF
|
||||
done < <(jq -r '.['$i'].trigger|keys[]' ${CONFIG})
|
||||
fi
|
||||
|
||||
NAME=$(jq -r .[$i].name ${CONFIG})
|
||||
COMMENT=$(jq -r .[$i].comment ${CONFIG})
|
||||
if [ "${NAME}" != "null" ] && [ "${COMMENT}" != "null" ]; then
|
||||
echo "# ${NAME}: ${COMMENT}" >> ${CRONTAB_FILE}
|
||||
elif [ "${COMMENT}" != "null" ]; then
|
||||
echo "# ${COMMENT}" >> ${CRONTAB_FILE}
|
||||
fi
|
||||
|
||||
echo "${SCHEDULE} ${COMMAND}" >> ${CRONTAB_FILE}
|
||||
|
||||
if [ "$(jq -r .[$i].onstart ${CONFIG})" == "true" ]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user