view deploy/provision.d/140-cron.sh @ 1592:72d9219f2f19 dockerise

Rejig explore page
author Chris Cannam
date Fri, 18 Aug 2017 14:46:06 +0100
parents c18460da6620
children 073a75bf07fb
line wrap: on
line source
#!/bin/bash

set -e

# Initialise directories used as targets for cron activity (if they
# don't already exist)

for dir in \
    /var/files/backups \
    /var/doc \
    /var/files/git-mirror ; do
    if [ ! -d "$dir" ]; then
        mkdir -p "$dir"
        chown -R code.www-data "$dir"
        chmod g+s "$dir"
    fi
done

# Copy cron scripts to the appropriate destinations

cd /var/www/code

if [ ! -d /etc/cron.minutely ]; then
    mkdir -p /etc/cron.minutely
    echo '*  *    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.minutely )' >> /etc/crontab
fi

for t in minutely hourly daily monthly; do
    for s in deploy/config/cron.$t/[0-9]* ; do
        name=$(basename $s)
        dest="/etc/cron.$t/$name"
        if [ ! -f "$dest" ]; then
            cp "$s" "$dest"
            chmod +x "$dest"
        fi
    done
done