modified: n.fq
[GalaxyCodeBases.git] / tools / etc / resumeblock.sh
blob9826003430a939e90feee22cb214017804aa66d1
1 #!/bin/bash
3 source_disk=/dev/disk0s4
4 host='huxs@lab.luo-lab.org'
5 host_image=/share/users/huxs/t/disk0s4.img
7 bytes_transferred() {
8 if ! ssh -p2211 "$host" "test -e '$host_image'"; then
9 echo 0
10 return
12 ssh -p2211 "$host" "stat -c '%s' '$host_image'"
14 bytes_total() {
15 #echo $(( $(blockdev --getsz $source_disk) * 512 ))
16 echo `diskutil info $source_disk|grep 'Total Size'|awk '{print $5}'|sed 's/(//'`
19 echo "$(bytes_total) to $(bytes_transferred)"
21 while (( $(bytes_transferred) < $(bytes_total) )); do
22 ( dd bs=1 skip=$(bytes_transferred) count=0 2>/dev/null && cat ) < $source_disk | ssh -p2211 -T -c arcfour -o Compression=yes -x "$host" "cat >> '$host_image'"
23 done