Hopefully someone can help me out here!
Basically, I have a daily cron job to run backup of my /home. However, i backup to an external USB drive, which is /dev/sdb1 when connected. It is in my /etc/fstab to automount when connected to /mnt/backup - allowing the script to run no problem.
The Problem : My wifes MP3 player is USB, and when connected, it mounts as/dev/sdb1 - causing two problems.
1 - The fstab doesnt work, as the FS type is different. This is ok, I can mount the MP3 Player manually.
2 - The real problem, the backup script will run even if it is the MP3 player mounted, not the external drive. This is not good.
My solution was to edit the backup script run by cron to have it check to see if it is the MP3 player mounted, and if so, skip the backup for that day. Below is my script.
CODE
findit="NOMAD"
if [ "udevinfo -a -p /sys/block/sdb/ | grep "$findit"" ]
then
echo "NOMAD Found... No Backup"
exit 0
fi
echo "NOMAD Not Found - continuing with backup"
mirrordir -v /home /mnt/backup
Its not working, that is, it always returns "NOMAD Found...No Backup", when manually running the udev | grep actually returns "No Device Found"
What would be ideal is a way to have the MP3 player always have the id of /dev/sdb2/ this would solve all problems, allow me to add it to Fstab etc....
Is this possible?
If not, how can I fix my script?
Thanks,