I wrote a script to solve this. Some things are in Italian but i think you can easily understan how the scripts works. Anyway you can easily translate everything.
The script basically checks if the blackberry is connected to the network. If yes, it checks if a dummy file exists, if it does, it means that another istance of the script is already running so it exits. If no other istances are running, it checks when is the last time the script was ran (so not to backup the blackberry every 10minutes). If a dummy.file.time is older than 3 hours (10800 seconds), it starts the backup using rsync.
#!/bin/sh
# BlackBerry backup via SMB share
#
# Cosa fa lo script?
#
# Lo script fa il ping del blackberry
# Se il ping va a buon fine, controlla se esiste "$dummyfile"
# (per non eseguire più backup in parallelo).
# Se esiste "$dummyfile", controlla se "$dummyfiletime" è più
# vecchio di due ore (per non ripetere il backup in continuazione).
# Se "$dummyfiletime" è più vecchio di due ore, monta lo SMB share
# del blackberry e inizia il backup con rsync.
#
##### PARAMETERS START #####
logdate=$(date +"%m-%Y")
ip="192.168.1.5"
dummyfile="/media/truecrypt2/blackberry SMB Backup/dummy.file"
dummyfiletime="/media/truecrypt2/blackberry SMB Backup/dummy.file.time"
monta="mount -t cifs -o username=USER,password=PASSWORD //$ip/media/ /media/blackberrySMB/"
sincronizza="rsync -a /media/blackberrySMB /media/truecrypt2/blackberry\ SMB\ Backup"
scriptlog="/var/log/blackberrySMBbackup/script_$logdate.log"
rsynclog="/var/log/blackberrySMBbackup/rsync_$logdate.log"
dummyfiletimeage=$(( `date +%s` - `stat -L --format %Y "$dummyfiletime"` )) #age of the dummy.file.time
defaultage="10800" #in seconds
###### PARAMETERS END ######
echo "$(date +"%D %T") : BlackBerry SMB backup lanciato." >>$scriptlog
echo "Effettuo ping verso $ip" >>$scriptlog
if fping -c 1 -t 500 $ip >>/dev/null
then
echo "Risposta al ping ricevuta da $ip" >>$scriptlog
if [ -f "$dummyfile" ]
then
echo -e "dummy.file esistente. Forse il processo e gia in esecuzione. Esco.\n" >>$scriptlog
exit
else
echo "dummy.file non esistente. Controllo se dummy.file.time e piu vecchio di 3 ore." >>$scriptlog
if [ "$dummyfiletimeage" -gt "$defaultage" ]
then
echo "dummy.file.time e piu vecchio di 3 ore. Inizio il backup." >>$scriptlog
touch "$dummyfile"
rm "$dummyfiletime"
touch "$dummyfiletime"
umount //$ip/media/
umount //$ip/media/
$monta
echo "$(date +"%D %T") : BlackBerry SMB rsync lanciato." >>$rsynclog
rsync --verbose -a /media/blackberrySMB /media/truecrypt2/blackberry\ SMB\ Backup >>$rsynclog
echo "***************************" >>$rsynclog
umount //192.168.1.5/media/
rm "$dummyfile"
echo -e "Backup completato. Esco.\n" >>$scriptlog
exit
else
echo -e "dummy.file.time e piu recente di 3 ore. Esco.\n" >>$scriptlog
exit
fi
fi
else
echo -e "Nessuna risposta al ping da $ip. Blackberry non connesso. Esco.\n" >>$scriptlog
exit
fi