Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (17 sloc) 582 Bytes
#!/bin/bash
echo "Starting node-cron"
cp /etc/cron.daily/logrotate /etc/cron.hourly/logrotate
if [ -z "$TASK_SCHEDULE" ]; then
TASK_SCHEDULE='* * * * *'
fi
echo "TASK_SCHEDULE => $TASK_SCHEDULE"
if [ -z "$NPM_COMMAND" ]; then
NPM_COMMAND='start'
fi
export NPM_COMMAND=$NPM_COMMAND
echo "npm $NPM_COMMAND"
env >> /tmp/.env
cat /tmp/.env >> /etc/cron.d/my-cron-job
echo -n "$TASK_SCHEDULE" | cat - /tmp/crontab >> /etc/cron.d/my-cron-job
echo "Running cron"
cron && tail -f /var/log/cron.log