摘要: 写了个shell获取ip的函数,如下function GetLocalIP() { ifconfig | grep 'inet '| grep -v '127.0.0.1' | cut -d: -f2 | awk '{print $1}' |head -n1}添加到crontab中执行,发现得到的ip_address为空。这是由于crontab中的环境变量与用户环境的环境变量不一样,因其不会从缺省的用户profile文件中读入环境变量参数,最简单的方法是用source命令(.)如 . /etc/profile; bash -x xxx.sh 即可 阅读全文
posted @ 2013-07-24 14:59 westfly 阅读(567) 评论(0) 推荐(0)