linux设置定时任务

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

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值