当前位置:网站首页>crontab中定时执行shell脚本
crontab中定时执行shell脚本
2022-06-11 21:42:00 【多写文章能生发】
第一步:编写shell脚本

shell脚本第二行的命令做了一件事:把执行脚本时的时间写入/mysqlback/test.log文件
#!/bin/bash
echo $(date "+%Y-%m-%d %H:%M:%S")>>/mysqlback/test.log
第二步:添加crontab定时任务
执行以下命令打开定时任务编辑器
crontab -e
添加定时任务
*/1 * * * * /bin/sh /mysqlback/test.sh
*/1 * * * * 这个就是定时任务的执行频率,表示每分钟执行一次
/bin/sh /mysqlback/test.sh 这个就是执行第一步中创建的shell脚本
边栏推荐
- 快速排序的优化
- 实验10 Bezier曲线生成-实验提高-交互式生成B样条曲线
- 如何利用RPA机器人开启货代行业数字化转型第一步?
- Codeworks round 744 (Div. 3) problem solving Report
- Classes and objects (3)
- On the night of the joint commissioning, I beat up my colleagues
- Usage of esp32c3 Arduino Library
- RPA+低代码为何是加速财务数字化转型之利器?
- Experiment 10 Bezier curve generation - experiment improvement - control point generation of B-spline curve
- 2021 Niuke multi school 5 double strings
猜你喜欢

All inherited features

每日一题 - 罗马数字转整数

每日一题 -- 验证回文串

Flutter series: detailed explanation of container layout commonly used in flutter

如何利用RPA机器人开启货代行业数字化转型第一步?

Master of a famous school has been working hard for 5 years. AI has no paper. How can the tutor free range?

How to view the installation date of the win system

科普 | NFT的类型有哪些(上)

R语言书籍学习03 《深入浅出R语言数据分析》-第十章 关联规则 第十一章 随机森林

RPA super automation | nongnongji and cloud expansion accelerate financial intelligent operation
随机推荐
Rexroth overflow valve zdb6vp2-42/315v
继承的所有特征
Redis Foundation
JVM | virtual machine stack (local variable table; operand stack; dynamic link; method binding mechanism; method call; method return address)
动态内存管理(1)
Redis transaction
如何利用RPA机器人开启货代行业数字化转型第一步?
LaTex实战笔记 3-宏包与控制命令
Why is rpa+ low code a powerful tool to accelerate the digital transformation of finance?
C语言实现八种排序(2)
行而不辍,未来可期|云扩科技入选上海市专精特新企业
相对完善的单例模式
Servlet get form data
How does the chief financial officer of RPA find the "super entrance" of digital transformation?
Jenkins+allure integrated report construction
Endnotex9 introduction and basic tutorial instructions
R language book learning 03 "in simple terms R language data analysis" - Chapter 8 logistic regression model Chapter 9 clustering model
C语言实现迷宫问题
R语言书籍学习03 《深入浅出R语言数据分析》-第十二章 支持向量机 第十三章 神经网络
R语言相关文章、文献整理合集(持续更新)