Alternc  latest
Alternc logiel libre pour l'hébergement
compress_logs.sh
Go to the documentation of this file.
1 #! /bin/bash
2 
3 # How long do we wait before compressing the log ? Default: 2
4 DAYS=2
5 
6 for CONFIG_FILE in \
7  /etc/alternc/local.sh \
8  /usr/lib/alternc/functions.sh
9  do
10  if [ ! -r "$CONFIG_FILE" ]; then
11  echo "Can't access $CONFIG_FILE."
12  exit 1
13  fi
14  . "$CONFIG_FILE"
15 done
16 
17 stop_if_jobs_locked
18 
19 # ALTERNC_LOGS is from local.sh
20 
21 #Compress logs older than XX days
22 nice -n 10 find "$ALTERNC_LOGS" -type f -name '*.log' -mtime +$DAYS -exec gzip '{}' \;
23