#2 Can't find work directory.

Kapalı
stevet tarafından 2 yıl önce kere açıldı · 1 yorum
Steve Thielemann 2 yıl önce olarak yorumlandı

Running from cron, it can't find the work directory.

https://www.includehelp.com/golang/how-to-get-the-directory-of-the-currently-running-file-in-golang.aspx

import (
    "os"
    "path/filepath"
)

pathExecutable, err := os.Executable()
if err != nil {
    panic(err)
}
// Getting the directory path/name
dirPathExecutable := filepath.Dir(pathExecutable)
os.Chdir(dirPathExecutable)

That should have the program in the expected directory.

Running from cron, it can't find the work directory. https://www.includehelp.com/golang/how-to-get-the-directory-of-the-currently-running-file-in-golang.aspx ```go import ( "os" "path/filepath" ) pathExecutable, err := os.Executable() if err != nil { panic(err) } // Getting the directory path/name dirPathExecutable := filepath.Dir(pathExecutable) os.Chdir(dirPathExecutable) ``` That should have the program in the expected directory.
Steve Thielemann 2 yıl önce olarak yorumlandı
Katkıcı

On olympus, you'll see there's a roku.log in your home directory. (A symptom of this issue.) It won't find etherwake.

On olympus, you'll see there's a roku.log in your home directory. (A symptom of this issue.) It won't find etherwake.
Giriş yap bu konuşmaya katılmak için.
Kilometre Taşı Yok
Atanan Kişi Yok
1 Katılımcı
Yükleniyor...
İptal
Kaydet
Henüz bir içerik yok.