Tag Info

Hot answers tagged


The timeout command will do this for you, i.e. timeout 10s command It will kill command after 10 seconds. Instead of s for seconds, you can also use m for minutes, h for hours or d for days.


I assume you're not describing your real-world scenario: not only do you want to copy hundreds of thousands of files, but you want to sleep for hundreds of thousands of seconds... wtf?!? Anyway: while IFS= read -r file1 IFS= read -r file2 do cp "$file1" "${file1##*/}-backup" cp "$file2" "${file2##*/}-backup" sleep 1 done < inputFile


Sorry: I have not noticed the "txt file" with the "hundreds thousands of lines". This is just a naif solution... for a in test*; do ls -l $a; if [[ $((i++ % 2)) != 0 ]]; then sleep 1; fi; done Update: Explanation and (partially update to txt file with filenames). ...reformating: for a in `cat file.txt` do cp "$a" "$a-backup" ## REPLACE ...


Split urls into one file per host. Then run 'parallel -j5' on each file. Or sort urls and insert a delimiter '\0' when a new host is met, then split on '\0' and remove '\0' while passing that as a block to a new instance of parallel: sort urls.txt | perl -pe '(not m://$last:) and print "\0";m://([^/]+): and $last=$1' | parallel -j10 --pipe --rrs -N1 ...


For a large or a considerable range of ip's my recommendation for you is use ipset If want to block an entire country ip block you can use the geoip module for iptables.

Only top voted, non community-wiki answers of a minimum length are eligible