Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Answers to Frequently Asked Questions Tips and Tutorials My "Bread and Butter" Process Keep Alive Perl Script.... Post 60062 by Neo on Saturday 8th of January 2005 04:17:38 AM
Old 01-08-2005
My "Bread and Butter" Process Keep Alive Perl Script....

For the newbies, I should have posted this years ago....

Here is the standard (tiny) "bread and butter" perl script (on Linux) I use in my crontab files to insure key processes are alive ( just in case ! ) like httpd, named, sshd, etc.

The example below if for named......

Code:
#!/usr/bin/perl

open(PS,"/bin/ps x|") || die "Can't Open PS";
while(<PS>) {
if (/usr\/sbin\/named/) { close PS; exit;}
}
close PS;
system("/usr/sbin/named");

One of my biggest "server fears" is that named will die for some strange reason, so I feel safe knowing that named is always running with the script above.

New Linux/UNIX users might find it useful.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pid still alive after "control C"

hi , i'm running 2 similar script (ksh) under AIX , the first go normally out when i type "control c" : ps before : notes01 19882 38990 0 11:54:48 pts/0 0:00 recover -s cla0bkpe -d /base/base01 -t May 05 23:02:17 2005 -v -f -a /base/base01/mail/mail-01/xxxx.nsf notes01 30866 40880 0... (4 Replies)
Discussion started by: Nicol
4 Replies

2. Shell Programming and Scripting

How to include RETURN KEY with Background process "&" in Shell Script

Hello All, I am a newbie in Shell script programming, and maybe you can help me with my query. I need to write a shell script (mntServer.ksh) that will start a background process and also to be able to run another script. The mntServer.ksh script contains: #!/bin/ksh... (1 Reply)
Discussion started by: racbern
1 Replies

3. Shell Programming and Scripting

Startup Script "run process with Timer"

Hi I have a script that execute every X minute for checking new files in a folder and converting to pdf. Is there any way to start this script automatically on linux startup?. I use sleep function in script with infinite loop. while do killall -u `whoami` -q soffice soffice... (0 Replies)
Discussion started by: zawmn83
0 Replies

4. Shell Programming and Scripting

Shell script process remains after "exit 1"

I have a script that performs an oracle export: <snip> if then exp / full=y file=${exp_file} log=${exp_log} direct=y feedback=1000000 STATISTICS=NONE buffer=20000000 else exp / full=n owner=${schema_name} file=${exp_file} log=${exp_log} direct=y feedback=1000000... (4 Replies)
Discussion started by: Squeakygoose
4 Replies

5. Red Hat

"service" , "process" and " daemon" ?

Friends , Anybody plz tell me what is the basic difference between "service" , "process" and " daemon" ? Waiting for kind reply .. .. (1 Reply)
Discussion started by: shipon_97
1 Replies

6. Shell Programming and Scripting

Ksh script function, how to "EXIT 2" without killing the current process?

Hi, Using AIX 5.3 and Ksh. />ls -al /usr/bin/ksh -r-xr-xr-x 5 bin bin 237420 Apr 10 2007 /usr/bin/ksh /> I recently started working for a new employer. I have written UNIX K-Shell scripts for many years and have never had this particular issue before. Its perplexing me. I have... (2 Replies)
Discussion started by: troym72
2 Replies

7. Shell Programming and Scripting

Send "perl -e '...' " command through SSH, from a perl script

Hey guys I am trying to send a perl -e command to a number of systems using SSH. The command should retrieve some information for me. The problem is, the remote shell tries to interpolate my variables and doesn't get it should take the command literally and just execute it. Below the code.... (2 Replies)
Discussion started by: clrg
2 Replies

8. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

9. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
OCF_HEARTBEAT_NAMED(7)						OCF resource agents					    OCF_HEARTBEAT_NAMED(7)

NAME
ocf_heartbeat_named - Manages a named server SYNOPSIS
named [start | stop | status | monitor | meta-data | validate-all] DESCRIPTION
Resource script for named (Bind) server. It manages named as an HA resource. SUPPORTED PARAMETERS
named Path to the named command. (optional, string, default "/usr/sbin/named") rndc Path to the rndc command. (optional, string, default "/usr/sbin/rndc") host Path to the host command. (optional, string, default "/usr/bin/host") named_user User that should own named process. (optional, string, default "named") named_config Configuration file for named. (unique, optional, string, no default) named_pidfile PIDFILE file for named. (unique, optional, string, default "/var/run/named/named.pid") named_rootdir Directory that named should use for chroot if any. (unique, optional, string, no default) named_options Options for named process if any. (optional, string, no default) named_keytab_file named service keytab file (for GSS-TSIG). (optional, string, no default) monitor_request Request that shall be sent to named for monitoring. Usually an A record in DNS. (optional, string, default "localhost") monitor_response Expected response from named server. (optional, string, default "127.0.0.1") monitor_ip IP Address where named listens. (optional, string, default "127.0.0.1") SUPPORTED ACTIONS
This resource agent supports the following actions (operations): start Starts the resource. Suggested minimum timeout: 60. stop Stops the resource. Suggested minimum timeout: 60. reload Suggested minimum timeout: 60. status Performs a status check. Suggested minimum timeout: 10. monitor Performs a detailed status check. Suggested minimum timeout: 30. Suggested interval: 30. meta-data Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5. validate-all Performs a validation of the resource configuration. Suggested minimum timeout: 5. methods Suggested minimum timeout: 5. EXAMPLE
The following is an example configuration for a named resource using the crm(8) shell: primitive p_named ocf:heartbeat:named op monitor depth="0" timeout="30" interval="30" SEE ALSO
http://www.linux-ha.org/wiki/named_(resource_agent) AUTHOR
Linux-HA contributors (see the resource agent source for information about individual authors) resource-agents UNKNOWN 06/09/2014 OCF_HEARTBEAT_NAMED(7)
All times are GMT -4. The time now is 07:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy