?
Solved

script to verify that a process is running

Posted on 2002-07-01
4
Medium Priority
?
304 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 300 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
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…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month15 days, 13 hours left to enroll

850 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