Skip to content

Instantly share code, notes, and snippets.

@x7c1
Created April 13, 2019 06:24
Show Gist options
  • Select an option

  • Save x7c1/58044c5452b1f8fa8495f5b928485c9b to your computer and use it in GitHub Desktop.

Select an option

Save x7c1/58044c5452b1f8fa8495f5b928485c9b to your computer and use it in GitHub Desktop.
suspend after google-drive directories unmounted.
#!/bin/sh
set -eu
GOOGLE_DRIVE_TARGETS=$(
findmnt --source google-drive-ocamlfuse --json |
jq -r '.filesystems[].target'
)
if [ -z ${GOOGLE_DRIVE_TARGETS} ]; then
echo "not mounted: google-drive-ocamlfuse"
else
for target in ${GOOGLE_DRIVE_TARGETS}
do
echo "unmounting: ${target}"
fusermount -u ${target}
done
fi
echo "suspending..."
sleep 0.5
echo mem > /sys/power/state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment