我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

检查进程是否正在运行(使用进程名称)

Is there anyway in Go to check if a proces is running by searching by process name? I see ways to do it with PID, however I don't have the PID to search by. Thanks.

http://www.faqs.org/faqs/unix-faq/faq/part3/section-10.html, Find PID of a Process by Name without Using popen() or system()

No direct way available. You can use os/exec with pidof or pgrep to do this. Or read into procfs.

近期文章

  • 如何在main之外使用Logger
  • 将参数传递给GoLang中的filepath.Glob函数
  • 修改作为地图值的数组
  • 如何在Go中将[] interface {}转换为[]字符串?
  • 如何在Go中获取地图中的条目数?
  • 当前有哪些方法可以让您在C语言中调用Go函数?
  • 如何杀死goroutines? [重复]
  • 负整数到Golang中的二进制数[重复]
  • 构建一个多可执行的Go项目
  • 如何仅用4位来表示Go中的数字?
  • Docker中的Golang Build找不到本地导入
  • 了解原子加法和互斥量
  • 记录响应主体以进行日志记录
  • 具有Go的IAM身份验证的API网关HTTP客户端请求
  • Go中最快的数据加载方式
  • 在elasticbeanstalk上部署私有github repo golang应用程序
  • 如何在对象具有字符串键的Golang中解组JSON
  • GoLang go-cloud / wire问题,数组作为提供程序的参数
  • 转换golang时将负数保留在字符串负数中
  • 如何使用REST API将消息正确发布到简单的Go Chatserver

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华