Sponsored Content
Top Forums Shell Programming and Scripting perl process loop isn't running Post 302349698 by avronius on Tuesday 1st of September 2009 03:25:17 PM
Old 09-01-2009
I might recommend a minor rewrite of the sub daemonize function to include some reporting (as well as identifying the correct files that can't be written to...).
Change this around such that:
Code:
   chdir '/'                 or die "Can't chdir to /: $!";
   open STDIN, '/dev/null'   or die "Can't read /dev/null: $!";
   open STDOUT, '>>/tmp/awsd' or die "Can't write to /tmp/awsd: $!";
   open STDERR, '>>/tmp/awsd' or die "Can't write to /tmp/awsd: $!";
   defined(my $pid = fork)   or die "Can't fork: $!";
#   exit if $pid;
   if ($pid)
   {
      print "stuff that is relevant to the process is output to screen"
      exit
   }
   setsid                    or die "Can't start a new session: $!";
   umask 0;

This will let you know what it sees BEFORE you exit - it might help you to debug.

You might want to read up on the perl module "Log::Log4perl" - it might have some information that would make this more clear.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl problem - why isn't 'die' being called?

last week i started learning perl, so have limited skill and knowledge. why isn't 'die' being called and the script exiting before the 'directory created' line? if (! -d "$logdir") { system "mkdir -p $logdir" || die print "\nERROR: release log directory creation failed - $logdir: $!\n";... (4 Replies)
Discussion started by: mjays
4 Replies

2. UNIX for Dummies Questions & Answers

perl scripting for checking if a process is running

Hi All, I am new to perl and have been trying to write a short script to check a process.Though i havent reached to the stage where i can match the output. I am trying to pass a variable x with value /opt/RGw/csbp-base/CSBP_BAT.01.00.05/csbp_BAT.01.00.05.jar and then pass another variable... (2 Replies)
Discussion started by: pistachio
2 Replies

3. Shell Programming and Scripting

infinite loop to check process is running

Hi, I got a simple script working to check if a process is running and then email if it is not running anymore. My scenario is that I need to make sure the process is always running so instead of running the below script via cron I think it is better to a have a looping script to check... (12 Replies)
Discussion started by: yabai
12 Replies

4. Shell Programming and Scripting

script to monitor process running on server and posting a mail if any process is dead

Hello all, I would be happy if any one could help me with a shell script that would determine all the processes running on a Unix server and post a mail if any of the process is not running or aborted. Thanks in advance Regards, pradeep kulkarni. :mad: (13 Replies)
Discussion started by: pradeepmacha
13 Replies

5. Shell Programming and Scripting

loop when process running

Hi Gurus, Could you please help me to create a shell script that will be started by a cron job once every night at 24.00 h (that should bee easy:)) The shell script should control every 30 seconds the name of a process, and when the process doesn't run anymore it should execute a few further... (12 Replies)
Discussion started by: blackwire
12 Replies

6. Linux

X Window isn't running

X Window isn't working. When I ran startx I got an error message as shown in file attachment xwndow.png Accordingly, I removed /tmp/.X0-lock as reflecting in the attchment. Then again I ran the command and 2 more commands (shown in the attachment xwndow1.png) but they failed too. Any... (2 Replies)
Discussion started by: ravisingh
2 Replies

7. Shell Programming and Scripting

Bash Question: HowTo Exit Script with User Input While Process is Running Mid-Loop?

Hi, I have written a script that allows me to repetitively play a music file $N times, which is specified through user input. However, if I want to exit the script before it has finished looping $N times, if I use CTRL+c, I have to CTRL+c however many times are left in order to complete the loop.... (9 Replies)
Discussion started by: hilltop_yodeler
9 Replies

8. BSD

Process remians in Running state causing other similar process to sleep and results to system hang

Hi Experts, I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state. On doing cat /proc/<pid>wchan showing the "__init_begin" in the output. Can you please help me here... (0 Replies)
Discussion started by: naveeng
0 Replies

9. UNIX for Advanced & Expert Users

Process remians in Running state causing other similar process to sleep and results to system hang

Hi Experts, I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state. On doing cat /proc/<pid>wchan showing the "__init_begin" in the output. Can you please help me here... (6 Replies)
Discussion started by: naveeng
6 Replies

10. Shell Programming and Scripting

Command to get exact tomcat process I am running ignoring other java process

Team, I have multiple batchjobs running in VM, if I do ps -ef |grep java or tomcat I am getting multiple process list. How do I get my exact tomcat process running and that is unique? via shell script? (4 Replies)
Discussion started by: Ghanshyam Ratho
4 Replies
PERLPLAN9(1)						 Perl Programmers Reference Guide					      PERLPLAN9(1)

NAME
perlplan9 - Plan 9-specific documentation for Perl DESCRIPTION
These are a few notes describing features peculiar to Plan 9 Perl. As such, it is not intended to be a replacement for the rest of the Perl 5 documentation (which is both copious and excellent). If you have any questions to which you can't find answers in these man pages, contact Luther Huffman at lutherh@stratcom.com and we'll try to answer them. Invoking Perl Perl is invoked from the command line as described in perl. Most perl scripts, however, do have a first line such as "#!/usr/local/bin/perl". This is known as a shebang (shell-bang) statement and tells the OS shell where to find the perl interpreter. In Plan 9 Perl this statement should be "#!/bin/perl" if you wish to be able to directly invoke the script by its name. Alternatively, you may invoke perl with the command "Perl" instead of "perl". This will produce Acme-friendly error messages of the form "filename:18". Some scripts, usually identified with a *.PL extension, are self-configuring and are able to correctly create their own shebang path from config information located in Plan 9 Perl. These you won't need to be worried about. What's in Plan 9 Perl Although Plan 9 Perl currently only provides static loading, it is built with a number of useful extensions. These include Opcode, FileHandle, Fcntl, and POSIX. Expect to see others (and DynaLoading!) in the future. What's not in Plan 9 Perl As mentioned previously, dynamic loading isn't currently available nor is MakeMaker. Both are high-priority items. Perl5 Functions not currently supported in Plan 9 Perl Some, such as "chown" and "umask" aren't provided because the concept does not exist within Plan 9. Others, such as some of the socket- related functions, simply haven't been written yet. Many in the latter category may be supported in the future. The functions not currently implemented include: chown, chroot, dbmclose, dbmopen, getsockopt, setsockopt, recvmsg, sendmsg, getnetbyname, getnetbyaddr, getnetent, getprotoent, getservent, sethostent, setnetent, setprotoent, setservent, endservent, endnetent, endprotoent, umask There may be several other functions that have undefined behavior so this list shouldn't be considered complete. Signals in Plan 9 Perl For compatibility with perl scripts written for the Unix environment, Plan 9 Perl uses the POSIX signal emulation provided in Plan 9's ANSI POSIX Environment (APE). Signal stacking isn't supported. The signals provided are: SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, SIGFPE, SIGKILL, SIGSEGV, SIGPIPE, SIGPIPE, SIGALRM, SIGTERM, SIGUSR1, SIGUSR2, SIGCHLD, SIGCONT, SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU COMPILING AND INSTALLING PERL ON PLAN 9 WELCOME to Plan 9 Perl, brave soul! This is a preliminary alpha version of Plan 9 Perl. Still to be implemented are MakeMaker and DynaLoader. Many perl commands are missing or currently behave in an inscrutable manner. These gaps will, with perseverance and a modicum of luck, be remedied in the near future.To install this software: 1. Create the source directories and libraries for perl by running the plan9/setup.rc command (i.e., located in the plan9 subdirectory). Note: the setup routine assumes that you haven't dearchived these files into /sys/src/cmd/perl. After running setup.rc you may delete the copy of the source you originally detarred, as source code has now been installed in /sys/src/cmd/perl. If you plan on installing perl binaries for all architectures, run "setup.rc -a". 2. After making sure that you have adequate privileges to build system software, from /sys/src/cmd/perl/5.00301 (adjust version appropriately) run: mk install If you wish to install perl versions for all architectures (68020, mips, sparc and 386) run: mk installall 3. Wait. The build process will take a *long* time because perl bootstraps itself. A 75MHz Pentium, 16MB RAM machine takes roughly 30 minutes to build the distribution from scratch. Installing Perl Documentation on Plan 9 This perl distribution comes with a tremendous amount of documentation. To add these to the built-in manuals that come with Plan 9, from /sys/src/cmd/perl/5.00301 (adjust version appropriately) run: mk man To begin your reading, start with: man perl This is a good introduction and will direct you towards other man pages that may interest you. (Note: "mk man" may produce some extraneous noise. Fear not.) BUGS
"As many as there are grains of sand on all the beaches of the world . . ." - Carl Sagan Revision date This document was revised 09-October-1996 for Perl 5.003_7. AUTHOR
Direct questions, comments, and the unlikely bug report (ahem) direct comments toward: Luther Huffman, lutherh@stratcom.com, Strategic Computer Solutions, Inc. perl v5.18.2 2013-11-04 PERLPLAN9(1)
All times are GMT -4. The time now is 05:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy