09-25-2008
I wonder if this has something to do with the fact that the dprdaemon program runs in the background (using 'fork').
I have found this page:
FGA: Mistakes to avoid when designing Unix dmon programs
Which seems to indicate that the 'fork' should be taken out of the daemon script.
Here is part of the daemon script, which I got off the 'Net:
## Define functions
sub daemonize {
chdir '/' or die "Can't chdir to /: $!";
open STDIN, '/dev/null' or die "Can't read /dev/null: $!";
open STDOUT, '>>/dev/null' or die "Can't write to /dev/null: $!";
open STDERR, '>>/dev/null' or die "Can't write to /dev/null: $!";
defined (my $pid = fork) or die "Can't fork: $!";
exit if $pid;
setsid or die "Can't start a new session: $!";
umask 0;
}
## The following executable called by dpr_daemon
sub monitor_logfiles {
`/dplogs/dpr/dpr_monitor`;
}
## initialize Perl
$[ = 1; # set array base to 1
$| = 1; # flush the buffer
## prepare dpr_daemon
daemonize();
## summon dpr_daemon
while(1) {
monitor_logfiles;
#wait for 20 seconds
sleep(20);
}
The article suggests that yes this would work if run off the command line, but I think it is saying that if it is called by SRC, then it will automatically run in the background and therefore fork isn't necessary.
Hmmmm
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi!
Is it possible to add more ttys in Solaris, like with inittab in Linux? I want to switch between the ttys with Alt F1+F2+F3 .... like Linux does.
How can i do this? (1 Reply)
Discussion started by: donald1111
1 Replies
2. UNIX for Dummies Questions & Answers
Ran into a new one today at work......
I was told to start 2 servers which were shut down due to a power outage(I don't believe they were shut down incorrectly).
After fsck, both console logins appear with the message:
INIT: Command is respawning too rapidly. Check for possible errors.
>... (5 Replies)
Discussion started by: finster
5 Replies
3. UNIX for Dummies Questions & Answers
Hello.
System is a HP Visualize C3600 running X11 and after a power failure machine will not boot (see error messages below)
From what I've read, this may be caused by a corrupted etc/inittab file. Solution suggested on other websites is to boot in single user mode and edit file inittab... (2 Replies)
Discussion started by: westcoast
2 Replies
4. HP-UX
INIT:Command is respawning too rapidly
Check for errors:
id:cons /usr/sbin/getty console console
A solution I read about in a different HPUX Forums help pages on line, said to add the -h option to this command in the /etc/inittab file to correct the problem.
I tried this and it did not... (2 Replies)
Discussion started by: 1bigdog
2 Replies
5. Solaris
Hi,
In Solaris 9 and below release we are using the rc script in inittab. I don't have much idea abt inittab in Solaris.
In Solris 9 and below:
We use rc3 script to start up the server. And we run database script before the rc3.
os:23:respawn:/etc/init.d/database start >/dev/null 2>&1... (7 Replies)
Discussion started by: kalpeer
7 Replies
6. Solaris
Hi,
I have a solaris 10 server,which has a process running that communicates with other system.I have made following entry in the inittab file.
PM15:s12345:respawn:/ncm/bin/communicator
PM15 : Unique process ID
s12345 : run levels
respawn : if anytime the process... (2 Replies)
Discussion started by: asalman.qazi
2 Replies
7. UNIX for Dummies Questions & Answers
Today there was a situation where processes running from inittab was broken. Can someone help me understand, how to find out, who might have stopped those processes? Or how does it get broken?
G (2 Replies)
Discussion started by: ggayathri
2 Replies
8. AIX
hello,
i have an AIX6.1.7.2 machine that it was upgraded recently from AIX5.3.9.4.
when i kill system services that should restart automatically like /usr/sbin/cron it doesnt start.
i checked my /etc/inittab file and i confirmed that this service is in respawn status so when i kill this process... (2 Replies)
Discussion started by: omonoiatis9
2 Replies
9. UNIX for Dummies Questions & Answers
I am installing BusyBox on a device that does not have keyboard or serial connection, so I log into the system with SSH. I am in doubt about what to put in the inittab file. This is the content of the file:
::sysinit:/etc/init.d/rcS
::respawn:/bin/login
::shutdown:/sbin/swapoff -a... (1 Reply)
Discussion started by: richard78
1 Replies
10. Shell Programming and Scripting
Hi to all ,
i wrote a small script and i add it to inittab to start the script during Startup. The script works fine , if i call it from the prompt but if it is call from inittab it is runnng too but it does not recognize system variable like USER , LOGNAME.
Since i running out of ideas i... (12 Replies)
Discussion started by: Nadielosabra
12 Replies
init(8) System Manager's Manual init(8)
NAME
init - Process control initialization
SYNOPSIS
/sbin/init [0123456789MmQqSs]
DESCRIPTION
The init program initializes the system by creating and controlling processes. The processes run by init at each run level are defined in
the inittab file. The init program reads and processes the entries in the inittab file.
The init program considers the system to be in a run level at any given time; each run level has a specific group of processes that run at
that level. The init program operates in one of eleven run levels: 0-9 and Ss. Of these, only 0, s, 2, and 3 are configured in the inittab
file by default. The run level changes when a privileged user invokes init. The new init sends appropriate signals to the original init
that tell it which run level to change to.
Running the init program is the last step in the boot process after the root file system is mounted. The init program scans the inittab
file and looks for an entry with the initdefault keyword. If the entry is there, init uses the run level specified in that entry as the
initial run level to enter. If the entry is not found in the inittab file or if the inittab file does not exist, init requests that the
user enter a run level from the system console, /dev/console. If the user enters the letter s, init enters single user state, assigns the
virtual console terminal to the user's terminal and opens it for reading and writing. The su command is invoked and the system displays a
message on the console stating the location of the virtual console.
To change the run level, the user specifies either the 0, 2, 3, or s flag.
For the first post-boot execution of init to a run level other than single user, it searches the inittab file for entries at the new run
level that have the boot or bootwait keywords. If the run level that is specified matches the entry, the init program acts on these
entries before processing other entries in the inittab file. Any special initialization of the system, such as checking and mounting file
systems, takes place before users are allowed on the system. The init program then scans the inittab file to find all entries that are to
be handled for that level.
Before starting a new process, init reads each entry in the inittab file, and for each entry that should be respawned, init forks a child
process. After spawning all required processes, init waits for one of its descendant processes to stop, a power-fail signal, or a signal
that it should change the run level. If one of the preceding three conditions occurs, init reexamines the inittab file. You can add new
entries to the inittab file, but init does not reexamine the file until one of the three previous conditions actually occurs. To immedi-
ately reexamine the inittab file, invoke the init program with the q flag.
FLAGS
Shuts down and halts the system. Changes the run level to a multiuser state with local processes and daemons. Changes the run level to a
multiuser state with remote processes and daemons. Changes run level to that specified by the number flag in the /etc/inittab file. If no
such entry exists, no action is taken and no message is output. Moves control to the console device and halts to single-user mode. Forces
init to reexamine the entries in the inittab file and terminates any live processes which have had their configuration entries removed from
/etc/inittab. Users should be aware that when a getty(8) line has been removed from /etc/inittab, and a login shell is active on the ter-
minal line that was formerly designated in inittab as a getty entry, the login shell will be killed. Changes the run level to a single
user state with only the essential kernel services.
FILES
Specifies the command path Specifies the init command control file Specifies the permanent login accounting file
RELATED INFORMATION
Commands: getty(8), rc0(8), rc2(8), rc3(8), shutdown(8)
Calls: kill(2), reboot(2)
Files: inittab(4) delim off
init(8)