Results 1 to 4 of 4
I am building a Nagios monitoring system for my company's NOC and we use Qpage to run our pager system. Currently inorder to run Qpage, we have to manually start ...
- 10-14-2011 #1Just Joined!
- Join Date
- Oct 2011
- Posts
- 3
centos 5 rc local executes twice
I am building a Nagios monitoring system for my company's NOC and we use Qpage to run our pager system. Currently inorder to run Qpage, we have to manually start the daemon. What I have been tasked to do is make it so it starts up automatically. I wrote a small script that works exactly how I need it, So I stick a call to it in rc local so it will activate when the system starts. It does in fact startup, but when I look at the list of processes qpage is in there twice.
When I run the script by hand, it shows up once (unless I run it again while the current qpage process is running and then I will get two)
When I use rc local I always get two qpage processes.
Does rc local get run twice?
Or what am I doing wrong?
- 10-14-2011 #2Just Joined!
- Join Date
- Oct 2011
- Posts
- 3
qpage start script
rc local fileCode:#! /bin/sh chown root:root /dev/ttyUSB0 if [ -x /usr/local/bin/qpage ]; then /usr/local/bin/qpage -q 5& fi
Code:#!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. touch /var/lock/subsys/local /etc/rc.d/init.d/qpage
The first thing I see when I check after a reboot
Code:[root@localhost ~]# ps -A |grep qpage 1715 ? 00:00:00 qpage 4420 ? 00:00:00 qpage [root@localhost ~]#
- 10-17-2011 #3Just Joined!
- Join Date
- Oct 2011
- Posts
- 3
No one?
Is there a way I can check to see if it is running before I execute it?
Something like if 'ps -A | grep qpage returns 1 or more' then don't execute?
- 10-17-2011 #4Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
Don't know why it is running twice. The rc.local script does not get executed twice anyway.
To check for it first, you can put something like:
orCode:pidof -x qpage
Then right after that line, whichever you choose, put something like:Code:ps -eo pid,cmd|grep qpage
Are you sure there is not initscript that is starting it in /etc/init.d/?Code:if [ $? -eq 0 ]; then echo qpage is running else echo qpage is not running # code to start it fi
If I were you, I'd make an initscript for it, instead of calling it from rc.local. That way, you can control it with chkconfig and the /sbin/service script, and the system can handle starting / stopping it. Making one is easy...


Reply With Quote