Mailinglist Archive: opensuse (2576 mails)
| < Previous | Next > |
[opensuse] Help with bash script
- From: "Ben Kevan" <ben.kevan@xxxxxxxxx>
- Date: Thu, 12 Feb 2009 06:15:17 -0800
- Message-id: <op.uo8sjpcedy24ij@hcsuse01007250>
Ok.. so here's my criteria:
if file hasn't been modified in the last minute then
while file hasn't been modified in the last minute then
sleep for 59 seconds
done
else
copy the file to another directory
fi
And here is the process:
Script runs, launches a perl wrapper asynchronous script. This script will
write a file, and I need to wait for that file to be created so I can copy it.
This is ran nightly via cron.. The part I am having problems with is the
sniffing for that file. So here is what I have:
find /tmp/file -mmin -1 >/dev/null
if [ $? -eq 0 ]; then
while [ find /tmp/file -mmin -1 >/dev/null -eq 0 ]; do
sleep 59
done
else
cp /tmp/file /somewhere
fi
Or am I way off track, or looking at this the wrong way? The first thing I notice is the if may be redundant. And another thing to note, the script doesn't work as is so I know i'm doing something wrong.
--
I say never be complete. I say stop being perfect. I say let's evolve. Let the
chips fall where they may. -Fight Club
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
if file hasn't been modified in the last minute then
while file hasn't been modified in the last minute then
sleep for 59 seconds
done
else
copy the file to another directory
fi
And here is the process:
Script runs, launches a perl wrapper asynchronous script. This script will
write a file, and I need to wait for that file to be created so I can copy it.
This is ran nightly via cron.. The part I am having problems with is the
sniffing for that file. So here is what I have:
find /tmp/file -mmin -1 >/dev/null
if [ $? -eq 0 ]; then
while [ find /tmp/file -mmin -1 >/dev/null -eq 0 ]; do
sleep 59
done
else
cp /tmp/file /somewhere
fi
Or am I way off track, or looking at this the wrong way? The first thing I notice is the if may be redundant. And another thing to note, the script doesn't work as is so I know i'm doing something wrong.
--
I say never be complete. I say stop being perfect. I say let's evolve. Let the
chips fall where they may. -Fight Club
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
| < Previous | Next > |