报错现象:在shell下执行node没有任何问题,但crontab自动运行就会报错。

原因:node的安装路径:/root/.nvm/versions/node/v6.7.0/bin/node

Shell环境PATH变量中已配置,因此在shell下可以执行。

但要知道,我们这是在crontab下定时运行,因此需要检查crontab的环境变量。

[root@WEB4 node]# vim /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/ # For details see man crontabs # Example of job definition:
# .---------------- minute ( - )
# | .------------- hour ( - )
# | | .---------- day of month ( - )
# | | | .------- month ( - ) OR jan,feb,mar,apr ...
# | | | | .---- day of week ( - ) (Sunday= or ) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed

从上面的检查结果可以看出,node的path没有配置,此处增加下node的安装路径到PATH变量即可。

crontab 执行脚本,报错/home/scripts/eyeMonitor.sh: line 8: node: command not found的更多相关文章

  1. vmware安装minimal centos报错/etc/rc5.d/s99local : line:25 : eject : command not found

    今天在用centos mini 版的时候创建虚拟机出现错误提示:vmware安装minimal centos报错/etc/rc5.d/s99local : line:25 : eject : comm ...

  2. /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh: line 19: mysql: command not found

    [root@test ~]# tail -f /tmp/zabbix_agentd.log /var/lib/zabbix/percona/scripts/get_mysql_stats_wrappe ...

  3. crontab执行python报错原因总结

    1.相对路径导致   2.环境变量问题,py脚本首行应指定python路径,不能用软链接   3.python3.3是默认utf-8,需要 &&脚本   最好使用crontab -e ...

  4. win-sudo插件解决Git bash 执行脚本报错问题 bash: sudo: command not found

    Windows git bash 默认没有sudo命令,可以添加win-sudo插件实现该功能 curl -s https://raw.githubusercontent.com/imachug/wi ...

  5. RabbitMq安装成功后执行命令报错(Error: unable to connect to node 'rabbit@DESKTOP-LPKSION': nodedown)

    我们直接来看解决方案吧.首先打开服务,找到RabbitMq服务. 双击打开后选择登陆选项卡: 点选此账户,输入你计算机的登录名称.点击浏览: 在这里输入你的用户名,点检索: 这里的密码输入你电脑开机登 ...

  6. 【Selenium】【BugList4】执行pip报错:Fatal error in launcher: Unable to create process using '""D:\Program Files\Python36\python.exe"" "D:\Program Files\Python36\Scripts\pip.exe" '

    环境信息: python版本:V3.6.4 安装路径:D:\Program Files\python36 环境变量PATH:D:\Program Files\Python36;D:\Program F ...

  7. oracle脚本执行多条语句报错

    情况一: create table edu_group_parent ( group_id ) primary key not null, group_name ), group_url ), gro ...

  8. 执行mysqld_safe报错:mysqld does not exist or is not executable

    执行mysqld_safe报错: [root@edu data]# /usr/local/mysql5.7/bin/mysqld_safe --user=mysql160427 12:41:28 my ...

  9. 数据库执行sql报错Got a packet bigger than 'max_allowed_packet' bytes及重启mysql

    准备在mysql上使用数据库A,但mysql5经过重装后,上面的数据库已丢失,只得通过之前备份的A.sql重新生成数据库A. 1.执行sql报错 在执行A.sql的过程中,出现如下错误:Got a p ...

随机推荐

  1. Flappy Bird背后的故事

    更多有价值的互联网文章:晓煦分享(http://www.ihuxu.com/share) 由越南游戏工程师阮哈东(Nguyen Ha Dong)开发的Flappy Bird这款游戏,画面不算精致且看起 ...

  2. arpspoof与其他几款工具的使用

    arpspoof 是一款进行arp欺骗的工具 arpspoof -i 网卡 -t 目标ip 默认网关 如果kali没有进行IP转发  那么目标就会因为配置错网而导致断网 这就是所谓的arp断网攻击 开 ...

  3. 隔行扫瞄/逐行扫瞄的介绍(Interlaced / Progressive)

    隔行扫瞄/逐行扫瞄的介绍(Interlaced / Progressive)   本篇不是着重在理论说明, 而是实际验証结果的分享, 所以只简略解释何谓交错与非交错, 请参考如后. 交错扫瞄(隔行扫瞄 ...

  4. Android PopupWindow中EditText获取焦点自动弹出软键盘

    公司的项目中要求在点击搜索的时候弹出一个搜索框,搜索框中有一个EditText,用于数据搜索关键字,要求在弹出PopupWindow的时候自动弹出软键盘,原以为只要写上着两行代码可以搞的问题: Inp ...

  5. makefile for opencv

    makefile #################################################### # Generic makefile - 万能Makefile # for ...

  6. shell 脚本实战笔记(8)--ssh免密码输入执行命令

    前言: ssh命令, 没有指定密码的参数. 以至于在脚本中使用ssh命令的时候, 必须手动输入密码, 才能继续执行. 这样使得脚本的自动化执行变得很差, 尤其当ssh对应的机器数很多的时候, 会令人抓 ...

  7. git中的needs merge问题

    这个问题是在先“储藏”起来了,后面再调用出来出现的错误. 解决的方法就是通过git add    ,git commit -m  提交上去就可以了.

  8. 51Nod:1085 背包问题

    1085 背包问题  基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题  收藏  关注 在N件物品取出若干件放在容量为W的背包里,每件物品的体积为W1,W2--Wn(Wi为 ...

  9. leetcode:Pascal's Triangle II【Python版】

    1.将tri初始化为[1],当rowIndex=0时,return的结果是:1,而题目要求应该是:[1],故将tri初始化为[[1]],返回结果设置为tri[0]即可满足要求: 2.最开始第二层循环是 ...

  10. ImageCollection

    https://documentation.devexpress.com/#WindowsForms/clsDevExpressUtilsImageCollectiontopic The collec ...