Hi, Looks OK. Try testing with echo instead of mail; email delays can be easily more than 4 minutes, which could be confusing things.
Jiri Sent from Samsung Mobile 0413 183 117 <div>-------- Original message --------</div><div>From: li...@sbt.net.au </div><div>Date:03/03/2014 15:20 (GMT+10:00) </div><div>To: slug@slug.org.au </div><div>Subject: [SLUG] can I delay script with sleep ? </div><div> </div>I have a crude script the email me a text from html page, that works fine; but, I would like to delay execution under certain condition, when it says 'delay' so, I've introduced 'if grep delay' loop below with sleep 240 I've received 'detected' email, so, grep was OK, and loop was entered BUT, final 'done' email was received pretty well immediately, it seems can I use 'sleep' like I did to delay script processing ? ===== #!/bin/bash /snip/ if [ -s /home/voytek/test/part2 ] ; then if grep -q "test" part2; then if grep 'delay' part2; then echo "wait 4min" mail -s "detected" voytek@... < test.txt sleep 240 fi links -dump test.html >> test.txt mail -s "done" voytek@... < test.txt fi fi /snip/ exit 0 -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html