ts2009 发表于 2018-8-22 09:57:41

每日一shell(一)磁盘日志

  请按照日期格式(xxxx-xx-xx)每日生成一个文件,例如今天生成的文件为2017-09-03.log, 并且把磁盘的使用情况写到到这个文件中。
  ## vim log.sh
  

#!/bin/bash  
d=`date +%F`
  
touch $d.log
  
df -hT > $d.log
  

crontab -e  

  00 * * * /bin/sh /root/shell/log.sh


页: [1]
查看完整版本: 每日一shell(一)磁盘日志