Shell编程---将查询信息写入当天文件中

将硬盘使用信息和查询Mysql进程相关信息写入新当天文件中

  • > 写入
  • >> 追加

日期格式可以看这篇:https://blog.csdn.net/qq_43288259/article/details/114834574

#!/bin/bash
filename=`date +%F`
c=`df -h`
d=`ps -aux|grep -o 'mysql.*'`
echo "$c" >/root/$filename.log
echo "$d" >>/root/$filename.log

查看一下 root下的当天日期的log文件
在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_43288259/article/details/114836594
今日推荐