how to run a killed process


 
Thread Tools Search this Thread
Operating Systems Solaris how to run a killed process
# 1  
Old 07-30-2009
how to run a killed process

hi,
i am creating a daemon process for updating the file at regular interval.one problem with this is if anybody kills the daemon it wont update the file.anybody have idea how to rerun the daemon if it killed.the code is written in c++ in solaries environment.


thnaks & regards
suresh
# 2  
Old 07-30-2009
Does the function have a signal handler? That will stop some kill commands - but not all signals are trappable.

One way is to run a script from crontab periodically to check for the presence of the daemon, and rerun it if it has been bumped off.

Normally daemons are run from a protected account, one that only root can su to for example. This stops random acts of aggression against your daemon.
# 3  
Old 07-30-2009
If you are running Solaris 10 or newer, you can use the SMF framework to have your daemon restarted automatically.
# 4  
Old 07-30-2009
Add an entry into /etc/inittab for your process and let the init process keep your daemon running. That's what it's for.
# 5  
Old 07-30-2009
jlliagre is right - It is no longer necessary to edit the /etc/inittab file directly. Administrators should use the Solaris Service Management Facility (SMF) to define services instead. Refer to smf(5) and the System Administration Guide: Basic Administration for more information on SMF.
# 6  
Old 07-30-2009
Quote:
Originally Posted by gnom
jlliagre is right - It is no longer necessary to edit the /etc/inittab file directly. Administrators should use the Solaris Service Management Facility (SMF) to define services instead. Refer to smf(5) and the System Administration Guide: Basic Administration for more information on SMF.
Why?

SMF is much more difficult to understand and manage than one line in /etc/inittab, and SMF is non-portable. Knowing how to apply the functionality of init and inittab is useful on Linux and Solaris and probably AIX, HP-UX, BSD, and Apple's OS X.

PS - Please don't quote the work of others without attribution. Your post is lifted verbatim from the contents of /etc/inittab and the contents of "man inittab" on Solaris:

Code:
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# The /etc/inittab file controls the configuration of init(1M); for more
# information refer to init(1M) and inittab(4).  It is no longer
# necessary to edit inittab(4) directly; administrators should use the
# Solaris Service Management Facility (SMF) to define services instead.
# Refer to smf(5) and the System Administration Guide for more
# information on SMF.
#
# For modifying parameters passed to ttymon, use svccfg(1m) to modify
# the SMF repository. For example:
#
#       # svccfg
#       svc:> select system/console-login
#       svc:/system/console-login> setprop ttymon/terminal_type = "xterm"
#       svc:/system/console-login> exit
#
#ident  "@(#)inittab    1.42    05/06/10 SMI"
ap::sysinit:/sbin/autopush -f /etc/iu.ap
sp::sysinit:/sbin/soconfig -f /etc/sock2path
smf::sysinit:/lib/svc/bin/svc.startd    >/dev/msglog 2<>/dev/msglog </dev/console
p3:s1234:powerfail:/usr/sbin/shutdown -y -i5 -g0 >/dev/msglog 2<>/dev/msglog
pt:s1234:powerfail:/usr/lib/svc/method/installupdates lock

And

Code:
Reformatting page.  Please Wait... done

File Formats                                           inittab(4)

NAME
     inittab - script for init

DESCRIPTION
     The /etc/inittab file controls process dispatching by  init.
     The processes most typically dispatched by init are daemons.

     It is no longer necessary  to  edit  the  /etc/inittab  file
     directly.  Administrators  should  use  the  Solaris Service
     Management Facility (SMF) to define services instead.  Refer
     to smf(5) and the  for more information on SMF.

# 7  
Old 07-30-2009
But once the daemon killed more than 5 times, it won't start again by inittab.
Solaris will write "off" into this entry under /etc/inittab.
a2156z
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capturing the killed process logs

I have two set of questions. 1) To skip killing some process automatically. 2) To kill other process and capture their log. I have set of process, some needs to be killed gracefully and others should be skipped. Listed are the process. adm 1522... (1 Reply)
Discussion started by: murali1687
1 Replies

2. Shell Programming and Scripting

how to prevent process from being killed

Hi,all.Well,I know someone has already asked this question before,however,It's too long before.So i post a new thread here. Here is the issue.I have a shell script that use awk to calculate something and the script takes about 15 mins,it will use 100% CPU,and the system automatically killed the... (2 Replies)
Discussion started by: homeboy
2 Replies

3. UNIX for Dummies Questions & Answers

Process Killed : Need to find why ?

Hi reader, I'm making a tool out of korn shell script that is running on a HP-UX server. But everytime i invoke the tool, it gets killed after a while (mid-process). I have tried re-running it a couple of times but each invocation ending up the same way .. following is a snippet of the o/p... (8 Replies)
Discussion started by: clakkad
8 Replies

4. UNIX for Dummies Questions & Answers

Protect a Process from Being Killed

Hi, I have a process which takes 13-15 mins for execution and its getting killed in the meantime.So can you please helpme out how to protect the process from getting killed. Thanks in advance. Regards, Harika (9 Replies)
Discussion started by: harikagrp
9 Replies

5. UNIX for Dummies Questions & Answers

SAS Process Getting Killed

HI all, I am very new to AIX (matter of fact Unix). We are currently automating out manual process using Unix Shell Scripting. My wrote a shell script which will accept the name of the sas job as parameter, checks the existense of the sas file in the specified folder. If it is not present,... (1 Reply)
Discussion started by: anubhav2020
1 Replies

6. Solaris

LDAP process getting killed

Hi all, Currently I am using LDAP to store some network related data, When I run following script ./ns-slapd ldif2db Execution of above script terminates displaying "Killed" on the console. As far as I know, a process can be killed by two ways- 1. manually running " kill -9 <PID of LDAP... (1 Reply)
Discussion started by: akash_mahakode
1 Replies

7. Shell Programming and Scripting

Sybase Process Killed - How to identify

I have this shell script and in case the sybase process is been killed how can identify whether the process was killed or not, as the error code always returns 0. #!/bin/sh isql -S SERVER -U user -P pass<<TOP select * from tableName go TOP echo $? (2 Replies)
Discussion started by: dinjo_jo
2 Replies

8. Programming

how to delay a process from getting killed

We are forking a process B from process A and the process B should display the details it reads from process C(daemon process) continuously. Let us say that the process C sents 100 packets.The process B receives all the 100 packets from the process C before it prints all details of 31... (1 Reply)
Discussion started by: cijkmysj
1 Replies

9. UNIX for Dummies Questions & Answers

Who is the parent of a killed process ?

Suppose we have the following process tree: init-> ProcessA->processB->processC then I kill processB Who is the parent of the processC? init or the processA (6 Replies)
Discussion started by: Puntino
6 Replies

10. UNIX for Dummies Questions & Answers

process not getting killed

I have a process that is in the sleeping state "S" and I have tried to stop it with a run control script that I use to stop/start it - but it does not stop. I have tried kill -9 <PID of process> with no change. I imagine that this process is sleeping with the kernel. It does not respond to... (5 Replies)
Discussion started by: finster
5 Replies
Login or Register to Ask a Question