美文网首页
crontab格式说明

crontab格式说明

作者: 陈威严 | 来源:发表于2020-05-16 09:38 被阅读0次
crontab格式说明.png

查看cron的运行状态
service cron status

参数说明

-e:编辑某个用户的crontab文件内容。如果不指定用户,则表示编辑当前用户的crontab文件。
-l:显示某个用户的crontab文件内容,如果不指定用户,则表示显示当前用户的crontab文件内容。

列出crontab文件
crontab -l

编辑crontab文件
crontab -e

20 9 * * * /bin/bash -l -c 'cd /home/webuser/Documents/rails_proj && git checkout branch_name && bundle exec rails runner -e production script/ruby_script.rb '

/bin/bash -l -c 说明

/bin/bash -l -c

man bash

-c `string` If the -c option is present, then commands are read from string.
            If there are arguments after the string, they are assigned to the positional parameters, starting with $0.
-l        Make bash act as if it had been invoked as a login shell (see INVOCATION below).

参考文章

https://linuxtools-rst.readthedocs.io/zh_CN/latest/tool/crontab.html

相关文章

  • crontab格式说明

    查看cron的运行状态service cron status 参数说明 列出crontab文件crontab -l...

  • Linux crontab设置定时任务

    连接远程服务器后输入命令: 编辑命令 重启crontab服务 crontab常用命令 crontab格式说明:* ...

  • golang cron 定时任务使用

    1、cron 表达式的基本格式 2、特殊字符说明 3、示例 最简单crontab任务 多个定时crontab任务 ...

  • linux_计划任务

    文件位置 /var/spool/cron 查看计划列表 crontab -l 格式说明 参考: https://b...

  • crontab的格式说明与栗子

    格式说明 分 时 日 月 星期 要运行的命令第1列分钟1~59第2列小时1~23(0表示子夜)第3列日1...

  • 树莓派用crontab定时运行python脚本

    crontab命令详解 1.命令格式: crontab [-u user] file crontab [-u us...

  • crontab定时执行

    crontab命令 crontab 格式 定时示例 第二种方式配置cron vim /etc/crontab 特殊...

  • Crontab格式

    第1列分钟1~59第2列小时1~23(0表示子夜)第3列日1~31第4列月1~12第5列星期0~6(0表示星期天)...

  • Linux定时任务

    crontab编辑说明 五个*说明 特殊符号 举例说明 crontab使用 重新启动crond服务 基本语法

  • Linux中利用crontab创建计划任务

    在linux中启动crontab服务: /etc/init.d/crond start crontab的命令格式 ...

网友评论

      本文标题:crontab格式说明

      本文链接:https://www.haomeiwen.com/subject/vpklohtx.html