#!/bin/bash
timestamp() {
date +"%T"
}
getEntries() {
wc -l /etc/passwd
}
echo "Scanned on":$( timestamp)and found:$( getEntries)"number of entries"|tee testlog.log当我手动运行这个脚本时,日志文件会更新,但是当crontab运行时,它不会更新日志文件,而是运行cront选项卡。
我的crontab -e
* * * * * /testcron.sh 发布于 2015-07-31 18:39:19
给出输出日志文件的完整路径:
echo "Scanned on":$( timestamp)and found:$( getEntries)"number of entries" |
tee /home/user/testlog.log现在检查/home/user目录。
https://stackoverflow.com/questions/31752848
复制相似问题