feat: added checks and loads the cron job
This commit is contained in:
21
start.sh
Normal file
21
start.sh
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user