Cron job execute backup.bash
- by leejava
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