Skip to content

Commit

Permalink
Workaround for #14
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzl0ver committed Oct 9, 2018
1 parent 92a729a commit d47f9ca
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ Install FUSE for OS X from <http://osxfuse.github.com>.
# Try to mount
mount /mnt/mybucket

**Workaround to unmount yas3fs correctly during host shutdown or reboot**

sudo cp contrib/unmount-yas3fs.init.d /etc/init.d/unmount-yas3fs
sudo chmod +x /etc/init.d/unmount-yas3fs
sudo chkconfig --add unmount-yas3fs
sudo chkconfig unmount-yas3fs on
sudo /etc/init.d/unmount-yas3fs start

To listen to SNS HTTP notifications (I usually suggest to use SQS instead) with a Mac
you need to install the Python [M2Crypto](http://chandlerproject.org/Projects/MeTooCrypto) module,
download the most suitable "egg" from
Expand Down
55 changes: 55 additions & 0 deletions contrib/unmount-yas3fs.init.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#! /usr/bin/env bash
#
# chkconfig: - 99 99
#
# description: Correctly unmount yas3fs mounts before going reboot or halt (a workaround for https://github.com/libfuse/libfuse/issues/1)
#

# how many seconds to wait for yas3fs queues flushing
TIMER=60

lockfile=/var/lock/subsys/unmount-yas3fs

start() {
/bin/touch $lockfile
}

stop() {
logger -t "unmount-yas3fs" "Unmounting yas3fs volumes..."
echo "unmount-yas3fs: Unmounting yas3fs volumes..."
awk '$1 ~ /^yas3fs$/ { print $2 }' \
/proc/mounts | sort -r | \
while read line; do
fstab-decode /bin/umount -f $line
done

logger -t "unmount-yas3fs" "Waiting for yas3fs queues get flushed..."
echo -n "unmount-yas3fs: Waiting for yas3fs queues get flushed"
c=0
while $(pgrep -x yas3fs &>/dev/null); do
if [ "$c" -gt "$TIMER" ]; then
logger -t "unmount-yas3fs" "Wasn't able to complete in $TIMER seconds, exiting forcefully..."
echo
echo "unmount-yas3fs: Wasn't able to complete in $TIMER seconds, exiting forcefully..."
/bin/rm -f $lockfile
exit 0
fi
echo -n "."
sleep 1
c=$((c+1))
done
logger -t "unmount-yas3fs" "done"
echo -n "done"
echo
/bin/rm -f $lockfile
}

case "$1" in
start) start;;
stop) stop;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
esac

exit 0

0 comments on commit d47f9ca

Please sign in to comment.