Sponsored Content
Top Forums Shell Programming and Scripting Doubt in the daemon running script Post 302441684 by mani_isha on Monday 2nd of August 2010 04:17:18 AM
Old 08-02-2010
Doubt in the daemon running script

Hi
I was going through one of my pjct script .Please let me know the logic for the deamon is running or not as i think the condtn should be vice-versa.

Code:
daemon_list = 'idp1278'
FAIL=0
for p in ${daemon_list}
do
  fail=0
  ps -fu  workarea  | grep ${p} > /dev/null 2>&1
  if [[ $? -ne 0 ]] then
    fail=1
    msg="${p} daemon is down"
    print -n "${p} is down"
  else
    msg="${p} daemon is up"
    print -n "${p} is up"
  fi

**where workarea is the hostname .
idp1278 i sthe daemon name .

when the process is running ,it is showing as below command :
Code:
ps -fu  workarea  | grep ${p} ->where $p is dp1278
 
workarea 28907 5374 1 02:41:54 pts/14 0:00 grep idp1278 workarea 6058 1 0 00:05:21 ? 0:00 ptr_DmnEnvelope idp1278L idp1278daemon_Sh.

My doubt i s:
1>when ? is coming the process is running actually but in the script it is wriiten if [? is !0 ]then daemon not running .. .what is the actual logic to check the daemon running .

2>ps -fu workarea | grep ${p}/dev/null 2>&1
where $p is idp1278 .

when i executedthe above script nothing came and it took me to next command prompt.At this time the idp12278 daem,on was running in my env .

Also please let me know why this command is used /dev/null 2>&1

Last edited by pludi; 08-02-2010 at 05:49 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

daemon running in AIX checking

how do u check if a daemon is running in AIX.. Is it ps -ef|grep daemon lssrc -s demon ??? Thanks! (0 Replies)
Discussion started by: karthikosu
0 Replies

2. Shell Programming and Scripting

Doubt in running shell script

Hi, I'm a newbie in shell script. I have a problem in running my a.out in a bash shell script named vetri . The following is the code. #!bash/bin ./a.out abc.xyz where ./a.out is a c++ bin file and abc.xyz is an argument. My ./a.out expects an input (cin >> temp). How can I give the... (5 Replies)
Discussion started by: lchokka
5 Replies

3. Solaris

doubt reg syslogd daemon

can anyone explain what is syslogd daemon in solaris. What is the use and how to start and stop the syslogd. (3 Replies)
Discussion started by: rogerben
3 Replies

4. Solaris

Port status/Running daemon

Hi, I need to run an application (Hudson) listening to port 8080 on a remote Solaris server. I have managed to start that application and tried to access it with my browser from my local PC, but unsuccessfully. I need to find out what is blocking the access to that port (or any other). A... (9 Replies)
Discussion started by: JVerstry
9 Replies

5. Shell Programming and Scripting

Find hangs with automountd daemon running

Hi, I am trying to find files with specific name using find / -name core -print.. this command is hanging and never completes as it is searching for all the automount filesystems ..i cant eliminate using "! -fstype nfs" as this is not a nfs filesystem pls let me know if anyone know how to... (2 Replies)
Discussion started by: to_bsr
2 Replies

6. Shell Programming and Scripting

script to run as a daemon

Hi, I have one query that is suppose if I have a script that pick up some files from source folder and put it into destination folder , and I want this script to run after every 1 hour, to make it configurable as per that I have options like crontab and nohup but when I test this script I have to... (2 Replies)
Discussion started by: nks342
2 Replies

7. Solaris

Gnome config daemon gconfd-2 running out of file descriptors

Hello, I need to increase the maximum number of open files for the Gnome configuration daemon, /usr/lib/gconfd-2. There is one of these for each username, no matter how many sessions they've got. We have lots of people using DTUs to log into a Sun Ray server using the same account (bad idea,... (3 Replies)
Discussion started by: Twirlip
3 Replies

8. UNIX for Dummies Questions & Answers

Oracle process running as user daemon

Hi, When process listing, I came across a process running as user daemon. daemon 23576 23574 0 07:32:04 ? 0:07 oracle (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq))) root 27526 27444 1 07:38:43 ttyp5 0:00 grep 23574 why a process runs as user daemon, when it should be... (3 Replies)
Discussion started by: wilsonee
3 Replies

9. AIX

Alert: Network Status Monitor daemon (rpcstat) is not running

Hi I am currently testing SCOM2012 on my AIX systems for monitoring. I tested it on 3 systems and immediately i got the following errors: Alert: Network Status Monitor daemon (rpcstat) is not running Source: AIX 7.1 Path: (left blank) Last modified by: (left blank) Last modified time:... (3 Replies)
Discussion started by: jsabo40
3 Replies

10. UNIX for Beginners Questions & Answers

How to write a daemon script?

My requirement is to run two scripts simultaneously. Let say, script1.ksh is running in a loop : example: script1.ksh is: for i in 1 2 3 do script2.ksh 1 & #psedu code which is required to write here # if script 2.ksh is running, execute a script3.ksh (which actually check the... (2 Replies)
Discussion started by: sumitc
2 Replies
DH_SYSTEMD_START(1)						     Debhelper						       DH_SYSTEMD_START(1)

NAME
dh_systemd_start - start/stop/restart systemd unit files SYNOPSIS
dh_systemd_start [debhelperoptions] [--restart-after-upgrade] [--no-stop-on-upgrade] [unitfile...] DESCRIPTION
dh_systemd_start is a debhelper program that is responsible for starting/stopping or restarting systemd unit files in case no corresponding sysv init script is available. As with dh_installinit, the unit file is stopped before upgrades and started afterwards (unless --restart-after-upgrade is specified, in which case it will only be restarted after the upgrade). This logic is not used when there is a corresponding SysV init script because invoke-rc.d performs the stop/start/restart in that case. OPTIONS
--restart-after-upgrade Do not stop the unit file until after the package upgrade has been completed. This is the default behaviour in compat 10. In earlier compat levels the default was to stop the unit file in the prerm, and start it again in the postinst. This can be useful for daemons that should not have a possibly long downtime during upgrade. But you should make sure that the daemon will not get confused by the package being upgraded while it's running before using this option. --no-restart-after-upgrade Undo a previous --restart-after-upgrade (or the default of compat 10). If no other options are given, this will cause the service to be stopped in the prerm script and started again in the postinst script. -r, --no-stop-on-upgrade, --no-restart-on-upgrade Do not stop service on upgrade. --no-start Do not start the unit file after upgrades and after initial installation (the latter is only relevant for services without a corresponding init script). NOTES
Note that this command is not idempotent. dh_prep(1) should be called between invocations of this command (with the same arguments). Otherwise, it may cause multiple instances of the same text to be added to maintainer scripts. Note that dh_systemd_start should be run after dh_installinit so that it can detect corresponding SysV init scripts. The default sequence in dh does the right thing, this note is only relevant when you are calling dh_systemd_start manually. SEE ALSO
debhelper(7) AUTHORS
pkg-systemd-maintainers@lists.alioth.debian.org 11.1.6ubuntu2 2018-05-10 DH_SYSTEMD_START(1)
All times are GMT -4. The time now is 11:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy