replace crontab file with -e

对着背影说爱祢 提交于 2019-12-03 12:35:10

You can source cron jobs from a file into your crontab using

crontab /path/to/cron/file/name

To make it more explicit for readability's sake, use the arrow < for sourcing.

crontab < /path/to/cron/file/name

Sourcing the cron jobs this way can throw error errors in crontab file, can't install in case the crontab entry you have are syntactically invalid in terms of scheduling, so make sure the cron entries are correct.

Also note that this will completely discard existing cronjobs and load the ones which are there in the file you pass, so it might help to save existing cron entries in a file using crontab -l > cron.backup

EDIT

In case you are looking for a way to change your default editor (to gedit or vi or something else) and not for a way to source cronjobs from file, you can export the VISUAL and EDITOR Path variables

export VISUAL=vim
export EDITOR=vim
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!