I'm trying to do consistent writes to a NFS folder that can go offline for maybe 30 seconds while i'm writing in it.
Why does the NFS server go down? How can you avoid that? Is it a planned downtime? If so, can you arrange to be notified automatically before and after the downtime?
I think you should not try to work around such problems in your application. Think about different solutions.
rsync could be useful: You write to a local file, and tell rsync to sync it to the storage server. If the connection breaks, you simply restart rsync until the entire file is transfered.
Also check the NFS mount options: The NFS client code should be able to block your write attempt until the NFS server goes online again. This will make your programm stall for that time, but should do no other harm.
Consider using a simple ssh connection (hoping that that won't go down as often as NFS):
#!/usr/bin/perl use strict; use warnings; open my $out,'| ssh server cat ">>" /tmp/log.txt' or die "open failed: + $!"; print $out "hello world\n" for 1..10; close $out;
Alexander
In reply to Re: Delaying NFS writes
by afoken
in thread Delaying NFS writes
by ZlR
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |