diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..62f28ad --- /dev/null +++ b/start.sh @@ -0,0 +1,21 @@ +#!/bin/bash +: ${WEBSITES:?"Environment variable WEBSITES is required but not set."} +: ${WEBHOOK_URL:?"Environment variable WEBHOOK_URL is required but not set."} +: ${DISCORD_ID:?"Environment variable DISCORD_ID is required but not set."} + +# Create a new temporary crontab file +temp_cron_file="/tmp/crontab_with_envs" + +echo "PATH=$PATH" > $temp_cron_file +echo "WEBSITES=$WEBSITES" >> $temp_cron_file +echo "WEBHOOK_URL=$WEBHOOK_URL" >> $temp_cron_file +echo "DISCORD_ID=$DISCORD_ID" >> $temp_cron_file + +# Append the cron configuration to the temp cron configuration file +cat $CRON_CONFIG >> $temp_cron_file + +# Load the new crontab file +crontab $temp_cron_file + +# Start cron +cron -f