1、打开定时任务文件夹

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

[root@localhost cron]#

2、查看定时任务

[root@localhost cron]# crontab -l

0 19 17 12 * /emqx/test0.sh

0 19 17 12 * /emqx/test1.sh

0 19 17 12 * /emqx/test2.sh

0 19 17 12 * /emqx/test3.sh

0 19 17 12 * /emqx/test4.sh

0 19 17 12 * /emqx/test5.sh

0 19 17 12 * /emqx/test6.sh

0 19 17 12 * /emqx/test7.sh

0 19 17 12 * /emqx/test8.sh

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

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐