Help - Search - Members - Calendar
Full Version: Backup Script
Linuxhelp > Support > Technical Support
Robert83
Hello,

I'm having HUGE problems here... got a backup script that mounts windows shares and copies stuff from it to the local computer, but if a user turns off his her computer during the copy process my server is screwed...and I cannot kill the cp nor the backup-script proccess and cannot acces /share3/
on which the backups are...

how can one solve this? I really do hope that there is a way to tell mount if the mounted drive fails to umount it or something similiar


Sincerely
Robert B
Termina
Could I get this script from you? wink.gif

Anyways, I'm not great (or decent) at bash programming, so I'm not sure how intellegent this answer will be...

Might you be able to (on your own, with a stopwatch) calculate how long each transfer usually takes (when no problems occur?). Let's say this is 2 minutes. Can you make a seperate script (that is started when you start the backup script) that, after 5 minutes or so, kill -9 PID of the cp and backup script program?

This way, if there is no problem, nothing is killed. If your script and cp freeze, however, they'll be killed.

That, or there is an easier way.

Next time someone turns off their computer, grab a newspaper, roll it up, and hit the back of their head with it. That or hook up a car batter to the 'Off' button of the computer. >=D
Robert83
Hi,

here it is, not to fancy, but did It myself and it's working.

CODE
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin

renice -10 -p $
mkdir /share3/backup

mkdir /share3/n-tibor
mount -t smbfs -o guest //n-tibor/My' 'Documents /share3/n-tibor
cp -au /share3/n-tibor /share3/backup
umount /share3/n-tibor
rmdir /share3/ntibor

mkdir /share3/backupDVD
tar -czf /share3/backupDVD/backup-gepek.tgz /share3/backup --exclude '*.mp3' --exclude '*.wma'


I was talking in the samba irc room, and a guy told me that it's a samba problem, when the computer is turned off you cant kill cp -au ...and I think cause samba aint time outing imediately and cp is waiting for something to happen...but after 4 hrs cp dies...and samba leaves a mount in the directory like this ?mount (in red) ...you just do a umount mount (without ?) and it's done.

Sincerely
Robert B
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.