日期:2014-05-16  浏览次数:20781 次

crontab运行shell失败
系统是红旗linux的,在crontab中加入
30 21 * * * /app/test/ncup/sbin/test.sh
其中test.sh脚本中开头是这样的
#!/usr/bin/ksh
#$1 txn_dt
cd /app/test
. .bash_profile
之后就是具体的处理逻辑。
查看/var/log/log/cron,发现
Dec 29 21:30:01 localhost crond[32366]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Dec 29 21:30:01 localhost crond[32367]: (test) CMD (/app/test/ncup/sbin/test.sh)
Dec 29 21:35:01 localhost crond[32384]: (root) CMD (/usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok)
有这样的日志,应该是已经执行到脚本了,但是脚本却没有执行起来(脚本单独执行是没有问题的),这是为什么?

------解决方案--------------------
Assembly code
#!/usr/bin/ksh
#$1 txn_dt
cd /app/test
. /etc/profile
. .bash_profile

------解决方案--------------------
探讨
? 公有云和私有云有哪些不同?? Hadoop和云计算有什么关系?? 什么是GTI云安全架构?? Google公司的云计算服务有哪些?? 云服务模式:SaaS、PaaS和IaaS...系统是红旗linux的,在crontab中加入
30 21 * * * /app/test/ncup/sbin/test.sh
其中test.sh脚本中开头是这样的
#!/usr/bin/ksh
#$1 tx……