Example #1
0
File: util.go Project: akutz/rexray
// ReadSpecFile reads the REX-Ray host address from the spec file.
func ReadSpecFile() (string, error) {
	host, err := gotil.ReadFileToString(SpecFilePath())
	if err != nil {
		return "", err
	}
	return gotil.Trim(host), nil
}
Example #2
0
File: util.go Project: akutz/rexray
// ReadPidFile reads the REX-Ray PID from the PID file.
func ReadPidFile() (int, error) {
	pidStr, pidStrErr := gotil.ReadFileToString(PidFilePath())
	if pidStrErr != nil {
		return -1, pidStrErr
	}
	pid, atoiErr := strconv.Atoi(pidStr)
	if atoiErr != nil {
		return -1, atoiErr
	}
	return pid, nil
}