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

 

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:1 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐