I am trying to check if a file is older than 5 minutes and if that is the case I want to call another shell script which sends me a mail.
check_file.sh:
JavaScript
x
#!/bin/sh
if [$(( (`date +%s` - `stat -L --format %Y /home/ftp/test.txt`) > (5*60) ))] = 1
then sh ./testmail.sh
fi
Error output: 3: ./check_file.sh: [1]: not found
Advertisement
Answer
Try something like:
JavaScript
if find /home/ftp/test.txt -mmin +5 &>/dev/null; then
<your code>
fi