Solved

script to verify that a process is running

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now