admin scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
443 B

  1. #!/bin/zsh
  2. year=$(date +%Y)
  3. month=$(date +%m)
  4. DAY=$(date +%d)
  5. logdir='/var/log/apache2/'
  6. find $logdir$year/$month/ -type f | xargs chmod 644
  7. find $logdir$year/ -type d | xargs chmod 755
  8. if [ $DAY -ne 1 ]; then
  9. yesterday=$((DAY-1))
  10. if [ $yesterday -lt 10 ]; then
  11. find $logdir$year/$month/ -name "0$yesterday*log" -type f | xargs -n1 bzip2
  12. else
  13. find $logdir$year/$month/ -name "$yesterday*log" -type f | xargs -n1 bzip2
  14. fi
  15. fi