Cron job execute backup.bash

Posted by leejava on Stack Overflow See other posts from Stack Overflow or by leejava
Published on 2010-06-08T08:59:53Z Indexed on 2010/06/09 4:02 UTC
Read the original article Hit count: 158

Filed under:

Dear all,

I wish to let cron executes backup.bash, but when I try to create cron as below:
*/1 * * * * /var/www/mango_gis/delete_snapshot.bash >/dev/null
It didn't execute my script at all.

Here is my script as below:

#!/bin/bash

get()
{
local pos=$1
shift
eval 'echo ${'$pos'}';
}

length(){ echo $#; }

find_snapshots()
{
echo $(ec2-describe-snapshots | xargs -n1 basename);
}

snapshots=$(find_snapshots)
len=$(length $snapshots)
row_count=$(($len/6))

if(($row_count > 6)); then
delete_count=$(($row_count-6))
for (( i=1; i<=$delete_count; i++ )); do

ec2-delete-snapshot $(echo $(get $((2+$((6*$(($i-1)))))) $snapshots)) > /dev/null
done
fi

Please advise...

Leakhina

© Stack Overflow or respective owner

Related posts about cronjob