定时循环执行某一个脚本的方法 - 严老板的技术梦想博客 - CSDN博客

定时循环执行某一个脚本的方法

2017年11月30日 22:59:11 weixin_36586564 阅读数:572 标签: 脚本 shell 更多
个人分类: Linux shell
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_36586564/article/details/78682096

定时一分钟:
1、for循环执行:

#!/bin/bash
for ((i=1; i<= 10000; i++))
do
  count=0
  echo "Number of execution scripts : $i"
  #要执行的脚本
  bash /root/shell/stopthree
  for ((k=1; k<= 60; k++))
  do
        sleep 1
        ((count++))
        echo "waiting $count seconds to excent"
  done
done
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

2、watch指令

watch -n 60 -d "bash /root/shell/stop"
  • 1

comments powered by Disqus