To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / deploy / provision.d / 140-cron.sh @ 1597:eeacb8332051
History | View | Annotate | Download (884 Bytes)
| 1 |
#!/bin/bash |
|---|---|
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
# Initialise directories used as targets for cron activity (if they |
| 6 |
# don't already exist) |
| 7 |
|
| 8 |
for dir in \ |
| 9 |
/var/files/backups \ |
| 10 |
/var/doc \ |
| 11 |
/var/files/git-mirror ; do |
| 12 |
if [ ! -d "$dir" ]; then |
| 13 |
mkdir -p "$dir" |
| 14 |
chown -R code.www-data "$dir" |
| 15 |
chmod g+s "$dir" |
| 16 |
fi |
| 17 |
done |
| 18 |
|
| 19 |
# Copy cron scripts to the appropriate destinations |
| 20 |
|
| 21 |
cd /var/www/code |
| 22 |
|
| 23 |
if [ ! -d /etc/cron.minutely ]; then |
| 24 |
mkdir -p /etc/cron.minutely |
| 25 |
echo '* * * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.minutely )' >> /etc/crontab |
| 26 |
fi |
| 27 |
|
| 28 |
for t in minutely hourly daily monthly; do |
| 29 |
for s in deploy/config/cron.$t/[0-9]* ; do |
| 30 |
name=$(basename $s) |
| 31 |
dest="/etc/cron.$t/$name" |
| 32 |
if [ ! -f "$dest" ]; then |
| 33 |
cp "$s" "$dest" |
| 34 |
chmod +x "$dest" |
| 35 |
fi |
| 36 |
done |
| 37 |
done |
| 38 |
|
| 39 |
|
| 40 |
|