You have tried to access an archived page. Please go to the new https://root360.atlassian.net/wiki/spaces/KB to find more documents.


In this section you can find sample implementations to deploy Cron servers. 

It will be added to each brief assistance to Design Decisions, a process and a sample implementation (customization required) pointed out.

Bash Cron Job Deployment 

Example (adjustment necessary)

#!/bin/bash

if [ -z "$ROLES" ]; then
    echo 'Roles not set!'
    exit 1
fi

# Main
if [ "$ROLES" = "cron" ]; then
  # write crontab file
  echo '#Cron by install.sh' > tempfile
  echo '00 09 * * 1-5 echo hello' >> tempfile
  echo '00 15 * * * echo bla' >> tempfile


# cron example with custom logging
  echo "* * * * * date >> /var/log/application/cron.log && cd /var/www/ && /usr/bin/php cron.php >> /var/log/application/cron.log 2>&1" >> tempfile

  # Update crontab
  crontab tempfile
  # Clean Up
  rm tempfile
fi
echo 'Done successfully.'