脚本内容:

#!/usr/local/bin/bash

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin

cd /tmp

touch IOPS.sh

echo '#!/usr/local/bin/bash' >>IOPS.sh

echo 'PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin' >>IOPS.sh

echo "date | awk '{print \$4}' >>/tmp/io.txt" >>IOPS.sh

echo 'iostat -x | sed -n '2,3p' >>/tmp/io.txt' >>IOPS.sh

chmod a+x IOPS.sh

echo '* * * * * /tmp/IOPS.sh' >>/var/cron/tabs/root