Ubuntu Cron shell
crontab -e
第一次使用crontab会让你选择文本编辑器: ubuntu
Select an editor. To change later, run 'select-editor'. 1. /bin/ed 2. /bin/nano <---- easiest 3. /usr/bin/vim.basic 4. /usr/bin/vim.tiny Choose 1-4 [2]:选择3 ,则可使用vim 来编辑crontab文件。也可使用 "select-editor" 来指定编辑器。
若是想修改vim为crontab默认编辑器,还能够经过修改/etc/profile实现 vim
vim /etc/profile
export EDITOR=vim
export VISUAL=vim dom
编辑完须要重启cron服务 编辑器
sudo /etc/init.d/cron restart
还能够编辑/etc/crontab来实现定时任务 ide
vim /etc/crontab
# /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command 17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) #
更多cron 帮助: http://wiki.ubuntu.org.cn/CronHowto this