docker-cronjob 708 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env bash
  2. set -o pipefail # trace ERR through pipes
  3. set -o errtrace # trace ERR through 'time command' and other functions
  4. set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
  5. set -o errexit ## set -e : exit the script if any statement returns a non-true return value
  6. source /opt/docker/bin/config.sh
  7. rootCheck "$0"
  8. if [[ "$#" -eq 0 ]]; then
  9. echo "Usage: $0 '<cronjob line>'"
  10. exit 1
  11. fi
  12. # create crontab file
  13. touch /etc/cron.d/webdevops-docker
  14. chmod 0644 /etc/cron.d/webdevops-docker
  15. for CRONJOB_LINES in "$@"; do
  16. echo "$CRONJOB_LINES" >> /etc/cron.d/webdevops-docker
  17. done
  18. # Add required newline at end
  19. echo >> /etc/cron.d/webdevops-docker