今天遇到一个问题,在终端里运行newLISP脚本,一切正常,移动到crontab中就不行。即便crontab -e命令运行在同一个用户下,还是有问题。
由于newLISP脚本要用到hive和Hadoop,估计是环境变量的问题。所以先用newLISP shell运行(env)命令,将当前环境变量记录到文件evn.lsp中。
然后在newLISP脚本中加载之。
下面是env.lsp文件部分内容:
(set 'local-envs '(("LC_PAPER" "en_US.UTF-8") ("LC_ADDRESS" "en_US.UTF-8") ("HOSTNAME" "hadoopMaster.com")
("LC_MONETARY" "en_US.UTF-8")
("SHELL" "/bin/bash")
("TERM" "dumb")
("HADOOP_HOME" "/usr/local/hadoop")
("HISTSIZE" "5000")
("SSH_CLIENT" "123.125.91.21 44582 22")
("LC_NUMERIC" "en_US.UTF-8")
("SQOOP_HOME" "/home/chenshu/sqoop-1.4.4.bin__hadoop-1.0.0")
("SSH_TTY" "/dev/pts/7")
("LC_ALL" "en_US.UTF-8")
("HISTFILESIZE" "5000")
("USER" "chenshu")
("EMACS" "t")
("LS_COLORS" "")
("LC_TELEPHONE" "en_US.UTF-8")
("HBASE_HOME" "/usr/local/hbase")
("TERMCAP" "")
("TMOUT" "3600")
("COLUMNS" "146")
("MAVEN_HOME" "/opt/apache-maven-3.2.1")
("MAIL" "/var/spool/mail/chenshu")
("PATH" "/usr/local/Java/bin:/usr/local/hadoop/bin:/usr/local/hive/bin://usr/local/hbase/bin://usr/local/hive/bin:/usr/local/postgres9.1/bin:/us\
r/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/data/shell:/data/tools:/opt/apache-maven-3.2.1/bin/:/home/chenshu/sqoop-1.4.4.bin__hadoop-1.0.0/bin/\
:/home/chenshu/bin:/opt/apache-maven-3.2.1/bin/:/home/chenshu/sqoop-1.4.4.bin__hadoop-1.0.0/bin/")
("LC_MESSAGES" "en_US.UTF-8")