Sponsored Content
Top Forums Shell Programming and Scripting Shell script to notify of service down Post 302904830 by Yoda on Friday 6th of June 2014 05:10:13 PM
Old 06-06-2014
Here is one way of doing it:
Code:
#!/bin/ksh

for service in TaskControllerService StreamControllerService
do
        if /usr/jdk/instances/jdk1.6.0/bin/sparcv9/jps | /usr/sfw/bin/ggrep -q "$service"
        then
                print "$service online"
        else
                print "$service offline"
        fi
done > mail_body

mailx -s "Subject" user@domain.com < mail_body

If you don't have ggrep replace that line with:
Code:
if /usr/jdk/latest/bin/sparcv9/jps | grep "$service" 1>/dev/null 2>/dev/null

This User Gave Thanks to Yoda For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How the first script should notify in case there is no response from second

Hi Experts, I am trying to write a ksh script that it should notify in case there is no response from the other script. I mean to say that I got a.sh and b.sh the execution of b.sh depends on a.sh, so if there is no response from a.sh, b.sh should notify me about the same. Thanks in Advance (4 Replies)
Discussion started by: rajusa10
4 Replies

2. Shell Programming and Scripting

How to write a shell script to notify when certain texts appear in a file?

I have a server and occasionally the file mysqld.log would show something like /usr/libexec/mysqld: Disk is full writing './example_com_-_wordpress/wp_statpress.MYD' (Errcode: 122). Waiting for someone to free space... Retry in 60 secs How do I write a simple shell script to check mysqld.log... (1 Reply)
Discussion started by: acider
1 Replies

3. Shell Programming and Scripting

notify-send does not notify real time

Hi, I am having a little trouble getting notify-send to work the way I would like it to. I am using ubuntu - karmic koala 2.6.31-19-generic #56-Ubuntu SMP So here's the problem run the following commands one after the other. notify-send -i info -t 100000 -- "Hi" "world" & notify-send -i... (3 Replies)
Discussion started by: linuxpenguin
3 Replies

4. Shell Programming and Scripting

checking to see if a service is running in a shell script

How can I tell, in a shell script, if a certain service is running? I know how to do this on the command line, but not in a script. Is an error thrown somehow that I can check? Thanks. (6 Replies)
Discussion started by: daflore
6 Replies

5. Shell Programming and Scripting

Shell script for service

Hi, I want to add an application as a service in Linux(Fedora 12). It should be run always for monitoring my system. It never terminate unless kill it. I wrote this script, put it on /etc/init.d/myapp and added it to run level 2345: #!/bin/bash # # chkconfig: 2345 20 80 # description:... (3 Replies)
Discussion started by: pronetin
3 Replies

6. Shell Programming and Scripting

Monitoring Tomcat Service with shell script

Hello Forum, I have prepared script to monitor the tomcat status. Following is the script which will monitor tomcat instance. I need little modifcation in the script. My script will grep for process, the output of grep command will analyze by if condition under for loop and will send... (2 Replies)
Discussion started by: ooilinlove
2 Replies

7. Shell Programming and Scripting

Bash script to notify when ever any files are changed

Hi the following script let sthe user know whenevr any file is changed inserted or deleted in file system. but i am getting following error while running bash script ## LINUX SYSTEM FILE ARCHIVE NOTIFY ## if ; then echo "Usage '$0 folder waitseconds' " ; exit 1; fi if ; then echo "Folder... (1 Reply)
Discussion started by: programmingzeal
1 Replies

8. Shell Programming and Scripting

Service checking through shell script

I want to check the postgres service for client PC which is remotely placed through shell script , whether the Postgres service is working or not.I don't have an idea to develop this script.Please give me a code. Client PC IP Address: 10.66.1.133 (2 Replies)
Discussion started by: kannansoft1985
2 Replies

9. Shell Programming and Scripting

Notify as soon as an error is encountered in a script

Hi, The script below works okay and emails me the log in the end once the script completes but what I'm trying to do is to also notify me via an email as soon as the script encounters any error whatsoever. cat test.list hdisk0 00a6351a2c832da1 rootvg ... (7 Replies)
Discussion started by: mbak
7 Replies

10. UNIX for Beginners Questions & Answers

Shell script newbie- how to generate service log from shell script

Hi, I am totally a newbie to any programming languages and I just started an entry level job in an IT company. One of my recent tasks is to create a script that is able to show the log file of linux service (i.e. ntpd service) lets say, if I run my script ./test.sh, the output should be... (3 Replies)
Discussion started by: xiaogeji
3 Replies
AMSERVICE(8)						  System Administration Commands					      AMSERVICE(8)

NAME
amservice - run an amanda service on a client SYNOPSIS
amservice [-f input_file [-s]] [-o configoption...] hostname auth service DESCRIPTION
Amservice execute an Amanda service on a client. It can be used without amanda server configuration (amanda.conf and disklist). It can be used to check communication between a server and a client. Amservice reads stdin to capture the REQ packet to send to the client. See the amanda(8) man page for more details about Amanda. OPTIONS
hostname The hostname of the client. auth The auth to use, one of: bsd, bsdudp, bsdtcp, ssh, rsh or krb5. The client must be configured with this auth. service The amanda service to execute on the client. One of noop, selfcheck or sendsize. -f input_file Use the file input_file instead of stdin to read the REQ packet from. -s Redirect the first connected stream to stdin/stdout. The -f argument is required for the REQ packet, the REP packet is not printed on stdout. -o configoption See the "CONFIGURATION OVERRIDE" section in amanda(8). EXAMPLE
The noop service is easy to execute because it does not require a REQ packet: amservice hostname bsdtcp noop < /dev/null The example executes the noop service on the client using bsdtcp auth. This is useful for debugging connection problems. It print an OPTIONS line upon success. It is more difficult to execute the selfcheck or sendsize service, as these require a valid REQ packet. If you have already uccessfully run amanda, you can find valid REQ packets in the amandad.*.debug files. EXIT CODE
The exit code of amservice is one of: 0 = success 1 = error executing amandad on the client. As amservice doesn't parse the REP packet, it can only detect failures in executing amandad on the client. amservice can exit with value 0 even if the user is not authorized to execute the service. An error message will be printed. SEE ALSO
amanda(8), amanda(8), amcheck(8), amdump(8), amadmin(8) The Amanda Wiki: : http://wiki.zmanda.com/ AUTHOR
Jean-Louis Martineau <martineau@zmanda.com> Zmanda, Inc. (http://www.zmanda.com) Amanda 3.3.3 01/10/2013 AMSERVICE(8)
All times are GMT -4. The time now is 07:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy