Crontab 脚本不记录
Crontab script doesn't log
#!/bin/bash
timestamp() {
date +"%T"
}
getEntries() {
wc -l /etc/passwd
}
echo "Scanned on":$( timestamp)and found:$( getEntries)"number of entries"|tee testlog.log
当我 运行 这个脚本手动更新日志文件但是当 crontab 运行s 它不更新日志文件但是 cront 选项卡 运行s.
我的crontab -e
* * * * * /testcron.sh
给出输出日志文件的完整路径:
echo "Scanned on":$( timestamp)and found:$( getEntries)"number of entries" |
tee /home/user/testlog.log
现在检查 /home/user
目录。
#!/bin/bash
timestamp() {
date +"%T"
}
getEntries() {
wc -l /etc/passwd
}
echo "Scanned on":$( timestamp)and found:$( getEntries)"number of entries"|tee testlog.log
当我 运行 这个脚本手动更新日志文件但是当 crontab 运行s 它不更新日志文件但是 cront 选项卡 运行s.
我的crontab -e
* * * * * /testcron.sh
给出输出日志文件的完整路径:
echo "Scanned on":$( timestamp)and found:$( getEntries)"number of entries" |
tee /home/user/testlog.log
现在检查 /home/user
目录。