You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been running into issues with the go server, and the other servers when attempting to start linux-dash from my home directory.
For example:
jonny@raspberrypi:~ $ sudo ./linux-dash/app/server/index -listen="0.0.0.0:853" -static="/home/jonny/linux-dash/app/"
Starting http server at: 0.0.0.0:853
Error executing 'current_ram': fork/exec ./linux_json_api.sh: no such file or directory
Script output:
Error executing 'ram_intensive_processes': fork/exec ./linux_json_api.sh: no such file or directory
Script output:
Error executing 'cpu_intensive_processes': fork/exec ./linux_json_api.sh: no such file or directory
Script output:
Error executing 'disk_partitions': fork/exec ./linux_json_api.sh: no such file or directory
Script output:
Error executing 'docker_processes': fork/exec ./linux_json_api.sh: no such file or directory
Script output:
Error executing 'swap': fork/exec ./linux_json_api.sh: no such file or directory
Script output:
Error executing 'load_avg': fork/exec ./linux_json_api.sh: no such file or directory
Script output:
Error executing 'cpu_utilization': fork/exec ./linux_json_api.sh: no such file or directory
Script output:
^C
I fixed this by restoring the -scripts flag:
package main
import (
"bytes""flag""fmt""net/http""os""os/exec"
)
var (
listenAddress=flag.String("listen", "0.0.0.0:80", "Where the server listens for connections. [interface]:port")
staticPath=flag.String("static", "../", "Location of static files.")
scriptPath=flag.String("scripts", "./linux_json_api.sh", "Location of shell scripts used to gather stats.")
)
funcinit() {
flag.Parse()
}
funcmain() {
http.Handle("/", http.FileServer(http.Dir(*staticPath)))
http.HandleFunc("/server/", func(w http.ResponseWriter, r*http.Request) {
module:=r.URL.Query().Get("module")
ifmodule=="" {
http.Error(w, "No module specified, or requested module doesn't exist.", 406)
return
}
// Execute the commandcmd:=exec.Command(*scriptPath, module)
varoutput bytes.Buffercmd.Stdout=&outputerr:=cmd.Run()
iferr!=nil {
fmt.Printf("Error executing '%s': %s\n\tScript output: %s\n", module, err.Error(), output.String())
http.Error(w, "Unable to execute module.", http.StatusInternalServerError)
return
}
w.Write(output.Bytes())
})
fmt.Println("Starting http server at:", *listenAddress)
err:=http.ListenAndServe(*listenAddress, nil)
iferr!=nil {
fmt.Println("Error starting http server:", err)
os.Exit(1)
}
}
Hello!
I've been running into issues with the
go
server, and the other servers when attempting to startlinux-dash
from my home directory.For example:
I fixed this by restoring the
-scripts
flag:And here's the result:
Some questions:
linux-dash
? I'd like to use the command shown above incron
.Let me know if you have any questions!
Thanks.
The text was updated successfully, but these errors were encountered: