Solved

script to verify that a process is running

Posted on 2002-07-01
4
295 Views
Last Modified: 2010-04-21
I have a simple script that I run as a background process (korn shell, AIX 4.3) that reads in IP addresses, PINGs them, writes failures to a file, waits 120 seconds, reads the "failure" file and pages me (using telalert) if the address fails both attempts. When someone reboots the system, of course, this script doesn't restart. I suppose I could solve this by scheduling a cron job every 2 minutes, 7x24 but this seems inefficient. I'd rather run some sort of cron job every 15 minutes to make sure that my PINGing script is running. Im looking for suggestions.

Thanks,
Steve
0
Comment
Question by:SteveJ
4 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7122726
script being started at boot time are in /etc/init.d
There is a link to it in the corresponding runlevel directory for example /etc/rc2.d (not shure for AIX)
0
 
LVL 6

Accepted Solution

by:
bira earned 100 total points
ID: 7122947

  In AIX, place it in the /etc/inittab

    example

  yourscript:2:respawn:/yourdir/yourscript.ksh
0
 
LVL 1

Expert Comment

by:zevans
ID: 7134869
Comment on bira's comment...

AIX includes the mkitab command for adding entries to inittab. (If you break /etc/inittab accidentally when editing with vi, your machine may not boot and will certainly do some strange things at boot time.)

mkitab yourscript:2:respawn:/yourdir/yourscript.ksh

I'm lazy and usually just edit the file manually, but I do use mkitab on live machines to show due diligence. If you want to know how that line achieves what you need, drop us a line...

Zack
0
 
LVL 16

Author Comment

by:SteveJ
ID: 7137783
I don't know how to split points or I'd give zevens some credit for his comments. If there's a point shootout, let me know and I'll put some points out there in addition to those I've earmarked for this question.

Also, for what it's worth . . . I was looking for a script-oriented answer for a couple of reasons. I am not an administrator but it's helpful to me to know when the machine has been restarted . . . which is why I was interested in the process ID (which would presumably be different if the machine and derivatively my process was restarted.)

Thanks.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question