Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to use mbuffer to do ZFS replication with, but in order to do that, I have to start it in listening mode on the target host. That I would do from the master host by

ssh 10.10.10.11 mbuffer -s 128k -m 1G -I 9090 | zfs receive tank3/pro4

mbuffer will never timeout, but exit with success when a replication have completed.

Question

It is possible to timeout mbuffer if it haven't returned success within e.g. 2 minutes?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

There is timelimit utility in FreeBSD ports to limit execution time of any command. If timeout fired, command will be killed.

share|improve this answer
    
timeout is a similar utility for linux (at least debian and the like) –  ndemou 2 days ago

Yes, use a wrapper script to start the mbuffer process, record the PID associated with mbuffer, have the script sleep for 2 minutes then if the PID is still in existence, TERM kill the PID.

share|improve this answer

You could also initiate mbuffer through an all-in-one command that uses SSH as a transport. Not an issue if the destination is remote... more of a performance penalty if it's local...

zfs send tank3/pro4@snapshot | mbuffer -q -v 0 -s 128k -m 1G | ssh root@10.10.10.11 'mbuffer -s 128k -m 1G | zfs receive tank3/pro4'

If performance is an issue, you may be bound by CPU and SSH encryption. There are a couple of workarounds for that...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.