定時執行shell腳本,linux設置定時任務

 2023-11-30 阅读 28 评论 0

摘要:1、打開定時任務文件夾 [root@localhost cron]# cd /var/spool/cron 定時執行shell腳本?[root@localhost cron]# 2、查看定時任務 [root@localhost cron]# crontab -l linux定時任務指定用戶。0 19 17 12 * /emqx/test0.sh 0 19 17 12 * /emqx/test1.sh 0 19 17

1、打開定時任務文件夾

[root@localhost cron]# cd /var/spool/cron

定時執行shell腳本?[root@localhost cron]#

2、查看定時任務

[root@localhost cron]# crontab -l

linux定時任務指定用戶。0 19 17 12 * /emqx/test0.sh

0 19 17 12 * /emqx/test1.sh

0 19 17 12 * /emqx/test2.sh

shell定時任務,0 19 17 12 * /emqx/test3.sh

0 19 17 12 * /emqx/test4.sh

0 19 17 12 * /emqx/test5.sh

linux定時任務的步驟、0 19 17 12 * /emqx/test6.sh

0 19 17 12 * /emqx/test7.sh

0 19 17 12 * /emqx/test8.sh

linux定時任務每天0點執行,0 19 17 12 * /emqx/test9.sh

3、寫腳本

touch test0.sh

chmod 777 test0.sh

vim test0.sh

這里是測試emqx的數據

sysctl -w net.ipv4.ip_local_port_range=“500 65535”

echo 1000000 > /proc/sys/fs/nr_open

ulimit -n 100000

/data/emqtt-bench/emqtt_bench conn -h 192.168.1.1 -p 1883 -c 50000 --ifaddr 192.168.1.2

4、執行定時任務

crontab -e

0 19 17 12 * /emqx/test0.sh

5 crontab文件格式:

  •   *       *      *      *        command
    

minute hour day month week command

分 時 天 月 星期 命令

6、刪除定時任務

crontab -r

7、查看、設置開機自啟

systemctl list-unit-files crond

systemctl enable crond

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://808629.com/187618.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 86后生记录生活 Inc. 保留所有权利。

底部版权信息