cron 无法执行shell的问题
问题,shell程序能够正常执行,但是放入cron里面就无法执行,原因在于cron无法自动获取环境变量,
需要显示的告知他所使用的环境变量是什么,下面是一种解决办法,普通用户在.bash_profile 里面定义好环境变量,
然后再shell程序里面引入即可:
#!/bin/bash
. ~/.bash_profile
附上cron最常用的命令
1、新增cron :crontab -e
2、列出所有执行计划:crontab -l
3、查看执行日志:tail -f /var/log/cron
4、查看详细日志,需要再crontab -e 里面定义,比如输出到 /home/oracle/shell/log.log 2>&1
posted on 2017-09-20 14:47 xiaopang1983 阅读(51) 评论(0) 收藏 举报
浙公网安备 33010602011771号