博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何在Linux上的Shell脚本中添加crontab条目?
阅读量:2530 次
发布时间:2019-05-11

本文共 716 字,大约阅读时间需要 2 分钟。

crontab -e will an editor to edit the crontab entries. But how to add a crontab entry from a shell script on without interaction from users?

crontab -e将编辑器来编辑crontab条目。 但是如何在上的shell脚本中添加crontab条目而又无需用户交互?

You can try this piece of script:

您可以尝试以下脚本:

(crontab -l; echo "@reboot echo "rebooted"";) | crontab -

Note that the update by this line of script is not atomic. If some other programs edit the crontab between the first and second invokes of crontab, the edits will be lost. Hence, make sure there is not other programs/admins editing the crontab when you use this piece of script.

请注意,此脚本行的更新不是原子的。 如果其他一些程序编辑crontab 的第一和第二所调用之间crontab中,编辑将丢失。 因此,使用此脚本时,请确保没有其他程序/管理员在编辑crontab。

Answered by Vivian.
薇薇安回答。

翻译自:

转载地址:http://dilwd.baihongyu.com/

你可能感兴趣的文章
一道关于员工与部门查询的SQL笔试题
查看>>
Canvas基础
查看>>
[Hive - LanguageManual] Alter Table/Partition/Column
查看>>
可持久化数组
查看>>
去除IDEA报黄色/灰色的重复代码的下划波浪线
查看>>
Linux发送qq、网易邮件服务配置
查看>>
几道面试题
查看>>
【转】使用 WebGL 进行 3D 开发,第 1 部分: WebGL 简介
查看>>
js用正则表达式控制价格输入
查看>>
chromium浏览器开发系列第三篇:chromium源码目录结构
查看>>
java开发操作系统内核:由实模式进入保护模式之32位寻址
查看>>
第五讲:单例模式
查看>>
Python编程语言的起源
查看>>
Azure ARMTemplate模板,VM扩展命令
查看>>
在腾讯云上创建您的SQL Cluster(4)
查看>>
Activiti源码浅析:Activiti的活动授权机制
查看>>
数位dp整理
查看>>
UNIX基础知识
查看>>
bzoj 1179: [Apio2009]Atm
查看>>
利用LDA进行文本聚类(hadoop, mahout)
查看>>