青岛网站建设 上流,星子网招聘,网站服务器 内容更新,有没有一些有试卷做的网站资料
错误提示#xff1a; no crontab for root - using an empty one 888
原因剖析#xff1a; 第一次使用crontab -e 命令时会让我们选择编辑器#xff0c;很多人会不小心选择默认的nano#xff08;不好用#xff09;#xff0c;或则提示no crontab for root - usin…资料
错误提示 no crontab for root - using an empty one 888
原因剖析 第一次使用crontab -e 命令时会让我们选择编辑器很多人会不小心选择默认的nano不好用或则提示no crontab for root - using an empty one 888这时候我们要重新选择编辑器
解决方法
使用root用户登陆系统sudo root / su - root输入命令select-editor输入数字3 (选择vi编辑器 回车) 选择/usr/bin/vim.basic 这里在不同的机器上序号也不一定一致。如![[Pasted image 20220302142550.png]]重新输入crontab -e就可以进行编辑定时任务了 下面是添加定时任务案例 输入命令crontab -e
实操
系统 —— Ubuntu用户普通用户环境未配置root账户密码问题记录 首先编写完成脚本之后使用crontab -l 查看定时任务。此时该用户下无任务然后使用 crontab -e 编写任务出现让选择界面随便点选一个之后不能使用。这里我选择的是4 ftp123ubuntutest-virtual-machine:~$ crontab -eSelect an editor. To change later, run select-editor.
1. /bin/nano ---- easiest
2. /usr/bin/vim.basic
3. /usr/bin/vim.tiny
4. /bin/edChoose 1-4 [1]: 4这里在使用root用户按照如资料操作后并不能解决问题最后测试明白需要在出现问题的账户下使用select-editor命令来更改错误的模式。另外ubuntu系统和redhat系统不同的地方在于Ubuntu可以不再预先设置root账户的密码使用具有sudo 权限的用户使用 sudo passwd root 可以直接设置root账户密码。附部分错误调试代码
ftp123ubuntutest-virtual-machine:/var/spool/cron$ sudo vi /etc/crontab
[sudo] password for ftp123:
ftp123 is not in the sudoers file. This incident will be reported.
ftp123ubuntutest-virtual-machine:/var/spool/cron$ sudo vim /etc/crontab
[sudo] password for ftp123:
ftp123 is not in the sudoers file. This incident will be reported.
ftp123ubuntutest-virtual-machine:/var/spool/cron$ crontab -l
no crontab for ftp123
ftp123ubuntutest-virtual-machine:/var/spool/cron$ crontab -e
no crontab for ftp123 - using an empty one
888
1
# Edit this file to introduce tasks to be run by cron.
3
# Each task to run has to be defined through a single line
2
# # Each task to run has to be defined through a single line
15 * * * * ftp123 /home/ftp123/bin/clear_file.sh
?# indicating with different fields when the task will be run
^C
?
^C
?
^Z
[4] Stopped crontab -e
ftp123ubuntutest-virtual-machine:/var/spool/cron$ cd ~
ftp123ubuntutest-virtual-machine:~$ nano 1.sh
Use fg to return to nano.[5] Stopped nano 1.sh
ftp123ubuntutest-virtual-machine:~$