Commit a818bdbd authored by ligaishun's avatar ligaishun

Delete process_before.txt

parent 4806eba6
package app
import (
"bytes"
"io"
"os/exec"
"time"
)
type ProcessInfo struct {
PName string `json:"p_name"`
Pid string `json:"pid"`
User string `json:"user"`
Path string `json:"path"`
}
func GetProcessInfo(keyfile string)bytes.Buffer{
var buffer bytes.Buffer
var buffer_res bytes.Buffer
lsof := exec.Command("lsof")
grep := exec.Command("grep", keyfile)
head := exec.Command("head","-n","1")
read, write := io.Pipe() // Create a pipe
defer read.Close()
defer write.Close()
lsof.Stdout = write //write output into pipe write
grep.Stdin = read // grep read from pipe
grep.Stdout = &buffer// grep output
lsof.Start()
grep.Start()
lsof.Wait()
write.Close()
grep.Wait()
head.Stdin=&buffer
head.Stdout=&buffer_res
head.Start()
head.Wait()
return buffer_res
}
func StrFilter(str []string)(res []string){
for i:=0;i<len(str);i++{
if str[i]!=""{
res=append(res,str[i])
}
}
return
}
func CornProcessJob(times ){
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment