#2 Can't find work directory.

Chiuso
aperto 2 anni fa da stevet · 1 commenti
Steve Thielemann ha commentato 2 anni fa

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 ha commentato 2 anni fa
Collaboratori

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.
Sign in to join this conversation.
Nessuna milestone
Nessun assegnatario
1 Partecipanti
Caricamento...
Annulla
Salva
Non ci sono ancora contenuti.