2012-08-14 128 views
2

時間,原因不明,亞馬遜S3保險絲安裝在Linux服務器全天失敗。唯一的解決方案是umount然後再mount目錄。我試着寫了下面的shell腳本,當手動卸載它的工作,並重新安裝,但我學會了必須有一些其他的「狀態」當鏈接失敗,但實際上不是卸載。Linux的安裝失敗,並沒有連接錯誤傳輸端點從時間

原來的錯誤:

[[email protected] mnt]# cd s3fs 
[[email protected] s3fs]# ls 
ls: cannot access amazon: Transport endpoint is not connected 
amazon 
[[email protected] s3fs]# umount amazon 
[[email protected] s3fs]# mount amazon/ 

shell腳本試圖檢查安裝並重新安裝,如果失敗(曾在手動測試,但未能):

#!/bin/bash 

    cat /etc/mtab | grep /mnt/$1 >/dev/null 
    if [ "$?" -eq "0" ]; then 
     echo /mnt/$1 is mounted. 
    else 
     echo /mnt/$1 is not mounted at this time. 
     echo remounting now... 
     umount /mnt/$1 
     mount /mnt/$1 
    fi 

  1. 爲什麼會shell腳本如果我手動卸載目錄並運行測試工作,但是當傳輸端點失敗時,測試返回true並且remount不會發生?
  2. 什麼是解決它的最好方法?
+0

看來其他人也有類似的問題與其他雲服務和掛載點:https://github.com/redbo/cloudfuse/issues/15 – 2012-08-14 21:06:56

+0

另一個類似的掛載點問題和他們的解決方案是卸載和重新掛載:https://錯誤.launchpad.net/ubuntu的/ +源極/ GVFS/+錯誤/ 212789 – 2012-08-14 21:08:08

回答

0

我知道這是舊的,但它可以幫助其他面臨這個問題。 我們有我們的桶被卸載隨機獲得「交通運輸端點沒有連接」的錯誤了類似的問題。

而不是使用「貓的/ etc/mtab中」的,我用「DF-HT」,它與我的腳本工作。問題是它陷入了這個奇怪的狀態,一半被卸載,「mtab」仍然認爲它已經掛載;但我仍然不知道爲什麼。

這是我使用的代碼:

 
#!/bin/bash 

if [ $(df -hT | grep -c s3fs) != 1 ] 
then 
     # unmount it first 
     umount /path/to/mounted/bucket; 

     # remount it 
     /usr/local/bin/s3fs bucket-name /path/to/mount/bucket -o noatime -o allow_other; 

     echo "s3fs is down"; 

     # maybe send email here to let you know it went down 
fi 

另外,還要確保你運行你的腳本爲根,否則將無法卸載/重新掛載。

相關問題