current=`date +"%s"`
last=`cat /tmp/last_date`
difference=`echo "$current - $last" | bc`
if [ ! -e /tmp/lock_file ] && [ $difference -gt 70 ]
then
touch /tmp/lock_file
sleep 10
echo "your command"
rm -rvf /tmp/lock_file
date +"%s" > /tmp/last_date
fi
last=`cat /tmp/last_date`
difference=`echo "$current - $last" | bc`
if [ ! -e /tmp/lock_file ] && [ $difference -gt 70 ]
then
touch /tmp/lock_file
sleep 10
echo "your command"
rm -rvf /tmp/lock_file
date +"%s" > /tmp/last_date
fi
No comments:
Post a Comment