/var/run/*.pid already exist. Daemon already running?
来源:互联网 发布:修道入门 知乎 编辑:程序博客网 时间:2024/05/21 19:12
如题,我遇到的一个问题,这个问题的产生是因为非正常结束进程服务造成,比如突然断电等,我的操作就是pkill -9 server_name
造成的。
我反复的执行启动和停止服务的命令,但是用ps查看进程时,是没有成功的。后来 在网上看到重启服务器的命令,我就拿来搞了shutdown -h now
,我个二货,等了10分钟,再去连服务器的时候,总是连不上,忽然发现,麻蛋,我执行的是关机命令,而不是reboot
,sb了。。。有种被大鹅支配的恐惧。赶紧找机房同事去把服务器点亮!
重连上服务器后,依然是这个问题,进程没有起来。然后在网上看到了一下内容
(1) pid文件的内容:pid文件为文本文件,内容只有一行, 记录了该进程的ID。 用cat命令可以看到。 (2) pid文件的作用:防止进程启动多个副本。只有获得pid文件(固定路径固定文件名)写入权限(F_WRLCK)的进程才能正常启动并把自身的PID写入该文件中。其它同一个程序的多余进程则自动退出。 (3) 编程技巧: 调用fcntl设置pid文件的锁定F_SETLK状态,其中锁定的标志位F_WRLCK。 如果成功锁定,则写入进程当前PID,进程继续往下执行。 如果锁定不成功,说明已经有同样的进程在运行了,当前进程结束退出。
我看到了关键写入权限
, 我赶紧去/var/run/
下创建了一个a.pid文件,然后赋给他权限chmod 777 a.pid
然后,执行了一下启动服务的命令,结果成功了。
这时,我再去看看这个a.pid文件,里面已经有进程id了。问题解决!
阅读全文
0 0
- /var/run/*.pid already exist. Daemon already running?
- 处理:/var/redis/run/redis_6379.pid exists, process is already running or crashed
- /var/run/gdm.pid doesn't exist, perhaps GDM isn't running
- nginx 启动问题:nginx (pid ) already running.
- Socket file /var/lib/mysql/mysql.sock exists. Is another MySQL daemon already running with the same
- Another MySQL daemon already running with the same unix socket
- Another MySQL daemon already running with the same unix socket.
- Another MySQL daemon already running with the same unix socket
- Another MySQL daemon already running with the same unix socket.
- Another MySQL daemon already running with the same unix socket
- Another MySQL daemon already running with the same unix socket
- XAMPP:"Another web server daemon with SSL is already running"
- Another MySQL daemon already running with the same unix socket
- Another MySQL daemon already running with the same unix socket
- Another MySQL daemon already running with the same unix socket.
- Another MySQL daemon already running with the same unix socket
- Another MySQL daemon already running with the same unix socket.
- 解决opensips启动时出现PID file /var/run/opensips.pid does not exist 的错误
- java_实现Haffman树及其编码与解码
- Win7系统不能正常预览Word2010文档怎么办
- 利用注解动态生成sql
- 使用Session防止表单重复提交
- --DOM事件
- /var/run/*.pid already exist. Daemon already running?
- C语言有关time的函数小结
- 基于ubuntu12 32位安装交叉编译环境
- python圣斗士修炼(十六):json序列化
- PE文件结构详解(一)基本概念
- ThinkPHP3.2.2中自定义函数的一些方法
- 关于android获取json有null值造成崩溃的解决办法。
- int __builtin_constant_p (exp)函数的使用
- 进程间通信——几种方式的比较和详细实例