?
Solved

script to verify that a process is running

Posted on 2002-07-01
4
Medium Priority
?
301 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
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

752 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