Google-drive-ocamlfuse: one of the mount occasionally crash

Created on 21 Nov 2018  路  4Comments  路  Source: astrada/google-drive-ocamlfuse

i'm using bash script to run mount at startup :

!/bin/bash

google-drive-ocamlfuse -o allow_other -label storage01 /var/www/web1/media/videos/
google-drive-ocamlfuse -o allow_other -label storage02 /var/www/web2/media/videos/

but occasionally one of the mount crash after 2-3 hours while new video been uploading

i make cronjob to check every 5 minute
*/5 * * * * /usr/local/bin/checkstorage01.sh
*/5 * * * * /usr/local/bin/checkstorage02.sh

but cronjob cant restart my server, the bash script checkstorage01.sh :

!/bin/bash

if [ ! $(find /var/www/web1/media/videos | wc -l) -gt 1 ]; then
reboot
fi

my question is :
Do you know the easy way to remount automatically if one of the drive crash when mounting?

question

All 4 comments

If the google-drive-ocaml process hangs, you should kill it with -9, then run fusermount -u [mountpoint].

No, what I mean is that you don't need to reboot, you can have a single cron job that runs a script like this:

if [ ! $(find /var/www/web1/media/videos | wc -l) -gt 1 ] || [ ! $(find /var/www/web2/media/videos | wc -l) -gt 1 ]; then
  killall -9 google-drive-ocamlfuse
  fusermount -u /var/www/web1/media/videos/
  fusermount -u /var/www/web2/media/videos/
  google-drive-ocamlfuse -o allow_other -label storage01 /var/www/web1/media/videos/
  google-drive-ocamlfuse -o allow_other -label storage02 /var/www/web2/media/videos/
fi

wow thank you. i will use it. thank you very much.

Hope that works! Sorry but I didn't tested it. Let me know if it breaks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abrambailey picture abrambailey  路  7Comments

kevinjpickard picture kevinjpickard  路  3Comments

leighsjo picture leighsjo  路  3Comments

acardona picture acardona  路  3Comments

R-Chandra picture R-Chandra  路  3Comments