Results 1 to 2 of 2
Box 1 = client
Box 2 = server
Protocol: SSH
I think my scripts might conflict.
They might conflict on the hour.
I'm using cronjobs.
Maybe some of you can ...
- 10-04-2008 #1
Client-server ssh, possibility of cron job conflicts
Box 1 = client
Box 2 = server
Protocol: SSH
I think my scripts might conflict.
They might conflict on the hour.
I'm using cronjobs.
Maybe some of you can look at them and get an idea of what I mean.
I'm not too sure how to explain it.
There might be the possibility that whichever script gets loaded first will win.
I don't like that.
How do I make sure these scripts don't conflict on the hour?
I tried doing some flagon file, but I don't think that's good enough.
I think if I could do something like...
...then things would be ok.if [ -e root@101.101.101.101:/ramdisk/.serverflags/backupinprocess ]
then
exit
else
keep on truckin'
fi
Am I able to do that?
I haven't tried it, but if it doesn't, that's why I posted here.
* I just tried it. It didn't work.
:/
Box 1's script every half hour...
* /home/box1firetwo/scripts/archival/checks/backup-to-RAM is to prevent other backup scripts on the client from trying to access the server's ramdisk folder.Code:#!/bin/sh if [ -e /home/box1firetwo/scripts/archival/checks/backup-to-RAM ] then exit else echo "1" > /home/box1firetwo/scripts/archival/checks/backup-to-RAM ssh someuser@101.101.101.101 'umount /ramdisk' ssh someuser@101.101.101.101 'umount /ramdisk' umount /ramdisk ssh someuser@101.101.101.101 'mount /ramdisk' mount /ramdisk ssh someuser@101.101.101.101 'echo "1" > /ramdisk/.serverflags/flagon' cp -a --parents /home/box1firetwo/important /ramdisk cp -a --parents /home/box1firetwo/Desktop/.misc /ramdisk scp -r -p /ramdisk/home someuser@101.101.101.101:/ramdisk umount /ramdisk rm /home/box1firetwo/scripts/archival/checks/backup-to-RAM clear fi
Box 2's every 4 hours and 15 minutes script:
Code:universe:~# cat /home/someuser/scripts/backuptolexar #!/bin/sh if [ -e /ramdisk/.serverflags/flagon ] then exit else cp -a --parents /ramdisk/home/box1firetwo/important /media/lexar fi

- 10-07-2008 #2Linux User
- Join Date
- May 2008
- Location
- NYC, moved from KS & MO
- Posts
- 251
In your box1 script, you use
ssh someuser@101.101.101.101 'echo "1" > /ramdisk/.serverflags/flagon'
to set the backup-in-progress flag onto box2 but you never remove that flag when the back up is finished.
You need to add
ssh someuser@101.101.101.101 rm -f /ramdisk/.serverflags/flagon
after the line
rm /home/box1firetwo/scripts/archival/checks/backup-to-RAM
Box 2's ramdisk can only hold last 15minutes' data from box1 since it's being umounted and mounted every 15 minutes.
For your script, I would suggest the followings:
1. Get rid of the use of ramdisk unless the network speed is super fast that you want to take advantage of it. You just backup whatever from source to destination without box2's script running.
2. rsync would be a better choice (to replace scp) for backing data
3. You can also try boxbackup, which is not easy but it has features such as backup on file change. (You don't need any additional scripts, its backup run in daemon mode.)


Reply With Quote