goproc

package module
v0.0.0-...-a3728f5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2023 License: MIT Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

goproc

process control library for Go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInterrupt = errors.New("interrupt signal accepted.")

Functions

func CreatePidFile

func CreatePidFile(pid int, pidfile string) error

CreatePidFile pidと書き込むファイル名を受け取ってPIDファイルを作成する

func GetProcessName

func GetProcessName(pid int) (string, error)

GetProcessName 指定されたPIDのプロセス名を返す

func StartService

func StartService(done chan<- error, param ProcessParam)

StartService 非同期サービスを起動し、PIDを知らせる

func StopService

func StopService(param ProcessParam) error

StopService サービス停止コマンドを起動し、サービスが終了するまで待つ

func StopServiceByPid

func StopServiceByPid(pid int) error

StopServiceByPid PIDでプロセスを識別してシグナルを送信して終了する

Types

type ChildrenProcess

type ChildrenProcess struct {
	Name       string  `json:"name"`
	Cmdline    string  `json:"cmdline"`
	Pid        int     `json:"pid"`
	CpuPercent float64 `json:"cpuPercent"`
	Vms        string  `json:"vms"`
	Rss        string  `json:"rss"`
	Swap       string  `json:"swap"`
}

子プロセス情報

func GetChildProcess

func GetChildProcess(pid int) ([]ChildrenProcess, float64, uint64, error)

GetChildProcess 指定されたPIDの子プロセス情報を返す

type Process

type Process struct {
	Name          string            `json:"name"`
	CpuPercent    float64           `json:"cpuPercent"`
	CpuTotal      float64           `json:"cpuTotal"`
	CpuUser       float64           `json:"cpuUser"`
	CpuSystem     float64           `json:"cpuSystem"`
	CpuIdle       float64           `json:"cpuIdle"`
	CpuIowait     float64           `json:"cpuIowait"`
	Vms           string            `json:"vms"`
	Rss           string            `json:"rss"`
	Swap          string            `json:"swap"`
	Cmdline       string            `json:"cmdline"`
	Exe           string            `json:"exe"`
	Cwd           string            `json:"cwd"`
	Env           []string          `json:"env"`
	CreateTime    string            `json:"createTime"`
	Exist         bool              `json:"exist"`
	Status        string            `json:"status"`
	Pid           int               `json:"pid"`
	Ppid          int               `json:"ppid"`
	Children      []ChildrenProcess `json:"children"`
	SumCpuPercent float64           `json:"sumCpuPercent"`
	SumRss        string            `json:"sumRss"`
}

プロセス情報

func GetProcess

func GetProcess(pid int) (*Process, error)

GetProcess 指定されたPIDのプロセス情報を返す

type ProcessParam

type ProcessParam struct {
	SetEnv     []string `json:"setEnv"`
	WorkingDir string   `json:"workingDir"`
	Command    string   `json:"command"`
	Args       string   `json:"args"`
	RecordPid  bool     `json:"recordPid"`
	PidFile    string   `json:"pidFile"`
}

プロセス起動・停止に必要な情報

type Processes

type Processes []Process

func GetProcesses

func GetProcesses(pids []int) (Processes, error)

GetProcesses 指定されたPIDのプロセス情報をまとめて返す

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址