解决 Linux / Unix – crontab: no crontab for user using an empty one error and solution

上午再给一个新的机器里添加定时任务crontab -e时出现了

no crontab for chenrui - using an empty one
No modification made

chenrui是我机器的名字,也就是当前用户的username

解决方法是,根据你的系统确定系统的编辑器是什么。
我的是vim,那么解决方法是:切换到root用户,终端输入

export EDITOR=vim

如果是emacs,切换到root用户,终端输入

export EDITOR=emacs

如果是nano,切换到root用户,终端输入

export EDITOR=nano

知道解决方法后,这个错误的原因是,系统没有指定默认的编辑器。上面的命令也就是选择一个默认编辑器就可以了。
再此执行crontab -e。

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/Hello_Ray/article/details/84134502