Find the answer to your Linux question:
Results 1 to 2 of 2
hi, hi, i need a command in shell which can set the time limit for a script to run. meaning if i need to run a script in loop for ...
  1. #1
    Just Joined!
    Join Date
    Jun 2007
    Posts
    2

    Setting time limit for script to run

    hi,
    hi, i need a command in shell which can set the time limit for a script to run. meaning if i need to run a script in loop for two hours how can i do it? Actually for details it is a script to take data from tcpdump and put them into mysql. so i need time factor to set the running time for tcpdump.

  2. #2
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    Something like this (10 dumps in 2 hours):

    Code:
    for i in $(seq 10)
    do
      # dump
      sleep 12
    done
    I don't know how long it takes to make a dump, but you can vary the values of the seq and sleep commands.

    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...