Solved

script to verify that a process is running

Posted on 2002-07-01
4
299 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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating 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…
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…

738 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