Re: can I delay script with sleep ?

<[email protected]>
Newsgroups gmane.org.user-groups.slug.general
Message-ID <[email protected]>
you have your filename with a specific directory and one with a relative 
directory.  This may be confusing things.

if [ -s /home/voytek/test/part2 ] ; then
if grep -q "test" part2; then

-----Original Message----- 
From: [email protected]
Sent: Monday, March 03, 2014 3:20 PM
To: [email protected]
Subject: [SLUG] can I delay script with sleep ?

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



-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2014.0.4335 / Virus Database: 3705/7138 - Release Date: 03/01/14 



-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2014.0.4335 / Virus Database: 3705/7138 - Release Date: 03/01/14

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.