Crontab & Centos 环境变量 EDITOR

241 阅读1分钟

centos 切换编辑器为 nano

sudo yum install nano 
export EDITOR="/usr/bin/nano" # 设定临时环境变量 EDITOR 为 nano

debian 切换编辑器

update-alternatives --config editor

crontab 定时任务

crontab -u username # 切换用户
crontab -e # 编辑定时任务 [当前用户]
crontab -l # 列出设定任务
# crontab语法 -- $user忽略 由 -u 指定
$minute[0-59]  $hour[0-23]  $day[1-31]  $month[1-12]  $weekday[0-6]:0-Sunday  $command || $command && ...

cron 定时任务 /etc/cron.d/ 目录下

$minute[0-59]  $hour[0-23]  $day[1-31]  $month[1-12]  $weekday[0-6]:0-Sunday  $user  $command || $command && ...

cron.daily cron.weekly cron.monthly cron.hourly

存放 .sh 脚本 定时运行