func (linux *systemVRecord) Status() (string, error) {
	if ok, err := checkPrivileges(); !ok {
		return "", err
	}
	if !linux.isInstalled() {
		return statNotInstalled, ErrNotInstalled
	}
	statusAction, _ := linux.checkRunning()
	return statusAction, nil
}
Status - Get service status
package daemon
import (
	"os"
	"os/exec"
	"regexp"
	"strings"
	"text/template"
)
type systemVRecord struct {
	name         string
	description  string
	kind         Kind
	dependencies []string
}
func (linux *systemVRecord) servicePath() string {
	return "/etc/init.d/" + linux.name
}
func (linux *systemVRecord) isInstalled() bool {
	if _, err := os.Stat(linux.servicePath()); err == nil {
		return true
	}
	return false
}
func (linux *systemVRecord) checkRunning() (string, bool) {
	output, err := exec.Command("service", linux.name, "status").Output()
	if err == nil {
		if matched, err := regexp.MatchString(linux.name, string(output)); err == nil && matched {
			reg := regexp.MustCompile("pid  ([0-9]+)")
			data := reg.FindStringSubmatch(string(output))
			if len(data) > 1 {
				return "Service (pid  " + data[1] + ") is running...", true
			}
			return "Service is running...", true
		}
	}
	return "Service is stopped", false
}
func (linux *systemVRecord) Install(args ...string) (string, error) {
	installAction := "Install " + linux.description + ":"
	if ok, err := checkPrivileges(); !ok {
		return installAction + failed, err
	}
	srvPath := linux.servicePath()
	if linux.isInstalled() {
		return installAction + failed, ErrAlreadyInstalled
	}
	file, err := os.Create(srvPath)
	if err != nil {
		return installAction + failed, err
	}
	defer file.Close()
	execPatch, err := executablePath(linux.name)
	if err != nil {
		return installAction + failed, err
	}
	templ, err := template.New("systemVConfig").Parse(systemVConfig)
	if err != nil {
		return installAction + failed, err
	}
	if err := templ.Execute(
		file,
		&struct {
			Name, Description, Path, Args string
		}{linux.name, linux.description, execPatch, strings.Join(args, " ")},
	); err != nil {
		return installAction + failed, err
	}
	if err := os.Chmod(srvPath, 0755); err != nil {
		return installAction + failed, err
	}
	for _, i := range [...]string{"2", "3", "4", "5"} {
		if err := os.Symlink(srvPath, "/etc/rc"+i+".d/S87"+linux.name); err != nil {
			continue
		}
	}
	for _, i := range [...]string{"0", "1", "6"} {
		if err := os.Symlink(srvPath, "/etc/rc"+i+".d/K17"+linux.name); err != nil {
			continue
		}
	}
	return installAction + success, nil
}
func (linux *systemVRecord) Remove() (string, error) {
	removeAction := "Removing " + linux.description + ":"
	if ok, err := checkPrivileges(); !ok {
		return removeAction + failed, err
	}
	if !linux.isInstalled() {
		return removeAction + failed, ErrNotInstalled
	}
	if err := os.Remove(linux.servicePath()); err != nil {
		return removeAction + failed, err
	}
	for _, i := range [...]string{"2", "3", "4", "5"} {
		if err := os.Remove("/etc/rc" + i + ".d/S87" + linux.name); err != nil {
			continue
		}
	}
	for _, i := range [...]string{"0", "1", "6"} {
		if err := os.Remove("/etc/rc" + i + ".d/K17" + linux.name); err != nil {
			continue
		}
	}
	return removeAction + success, nil
}
func (linux *systemVRecord) Start() (string, error) {
	startAction := "Starting " + linux.description + ":"
	if ok, err := checkPrivileges(); !ok {
		return startAction + failed, err
	}
	if !linux.isInstalled() {
		return startAction + failed, ErrNotInstalled
	}
	if _, ok := linux.checkRunning(); ok {
		return startAction + failed, ErrAlreadyRunning
	}
	if err := exec.Command("service", linux.name, "start").Run(); err != nil {
		return startAction + failed, err
	}
	return startAction + success, nil
}
func (linux *systemVRecord) Stop() (string, error) {
	stopAction := "Stopping " + linux.description + ":"
	if ok, err := checkPrivileges(); !ok {
		return stopAction + failed, err
	}
	if !linux.isInstalled() {
		return stopAction + failed, ErrNotInstalled
	}
	if _, ok := linux.checkRunning(); !ok {
		return stopAction + failed, ErrAlreadyStopped
	}
	if err := exec.Command("service", linux.name, "stop").Run(); err != nil {
		return stopAction + failed, err
	}
	return stopAction + success, nil
}