22 lines
679 B
Bash
22 lines
679 B
Bash
#!/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
|