seo说要备份文件,然后自己搞不定,每天一份文件。写了个shell,加了个crontab -e任务。每天执行一次。

crontab:

59 23 * * * /root/sh/dumpApacheLog

shell:

#!/bin/sh
today=$(date +%Y%m%d)
newAccessLog="/usr/local/httpd/logs/"$today"access_log"
newErrorLog="/usr/local/httpd/logs/"$today"error_log"
mv /usr/local/httpd/logs/access_log $newAccessLog
mv /usr/local/httpd/logs/error_log $newErrorLog
touch /usr/local/httpd/logs/access_log
touch /usr/local/httpd/logs/error_log
chmod 777 /usr/local/httpd/logs/error_log
chmod 777 /usr/local/httpd/logs/access_log

相关文章:

  • 2021-10-24
  • 2021-11-12
  • 2022-12-23
  • 2021-06-25
  • 2022-01-21
  • 2021-10-29
  • 2021-09-16
  • 2021-05-02
猜你喜欢
  • 2022-12-23
  • 2021-05-25
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2022-01-22
相关资源
相似解决方案