Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt | ||
---|---|---|
| ||
In this section you can find sample implementations to deploy Cron servers. |
Cron job deployment via install.sh (bash)
Why bash?
It is usually available,
easy to understand and
stable
process
Caveat: definition of Cron in the script or config depending on the environment
Decide is what to do according to set environment variables
Write the crontab
Cleanup temporary files
Deployment
The bash script is expected by the configuration management system under a specific path and
called parameterized plain or by appointment
When it comes to the server by a cron server (ROLES contains "cron") is written a defined crontab
This also assumes that the Cron to be run, are actually stored in the specified directory and executable.
Example install.sh (adjustment necessary)
Code Block | ||
---|---|---|
| ||
#!/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.' |
Related
Tutorialstutorials
Filter by label (Content by label) | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Related
Componentscomponents
Filter by label (Content by label) | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Status | ||||
---|---|---|---|---|
|
Table of Contents | ||
---|---|---|
|
Filter by label (Content by label) | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|