Sponsored Content
Top Forums Shell Programming and Scripting How can i get the state of weblogic server Post 302582606 by jim mcnamara on Friday 16th of December 2011 01:04:57 PM
Old 12-16-2011
WLST and python are probably the most common ways to do this.

Example code:
WLST My Experiments: Server State using WLST

Write python code that displays the status. Use the above example. Assume you choose UP and DOWN as your personal interpretation of the weblogic status codes. That means we get either "UP" or "DOWN" from your python code.
Let's call it WLST.py

The shell to do this is simple. First create a file (call it email_addr) that has email/SMS addesses. SMS email address is a phone number with the carrier name:
Code:
5555555555@verizon.com \
[put as many email addresses as you need, one to a line followed by [space]\ ]
jsmith@mycompany.com

casll the script WLST.shl
Code:
#!/bin/bash
# script: WLST.shl check weblogic status
. /etc/profile 
[ -r  ~/.profile ] && .  ~/.profile   # execute login script
email_addr=$( cat  /path/to/email_addr)
cnt=0

for i in 1 2 3
do
    result=$( /path/to/WLST.py  )
    # result should only be "UP" or "DOWN"
    [ $result = "DOWN" ]  && cnt=$(( $cnt + 1 ))
    sleep 10
done
if [ $cnt -eq 3 ]; then
  echo "weblogic is down $(date)" | mailx  -s 'WARN weblogic down'  $email_addr
fi

set the script file to execute:
Code:
chmod +x WLST.shl

Finally add this to your crontab (use crontab -e )
Code:
* * * * * /path/to/my/WLST.shl  > /path/to/WLST.log 2&>1

Save the crontab entry.

This will run the script every minute, every day and with three failures you get email/TEXT.

read the crontab man page because getting a text message every minute may not be very helpful - change the runs to be every 5 minutes if you want.
 

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

difference weblogic server/webserver/app server

Hi All, I am getting confused with the terms below. All I know is an application can be installed on a server. But I see the following terms used in a company. All of them are installed on same Unix box. Could you please help me out in layman terms as to what these exactly means. (PS: I don't... (1 Reply)
Discussion started by: tostay2003
1 Replies

2. Solaris

Veritas WebLogic Server log files

Hi All, I am trying to change the log file to an incremental log file so that I do not needd to restart weblogic everytime the server /tmp directory reach 100% usage. I want to make it an incremental log, just like adm messages. At the moment, operation process is written to a log file (eg:... (1 Reply)
Discussion started by: ronny_nch
1 Replies

3. Shell Programming and Scripting

Get the STATE of the weblogic instances via shell script.

Can I get the STATE(instance are RUNNING or not and HEALTH is OK or not) of the weblogic instances(Admin and Managed) running on my unix machine via shell script. Someone told me that it can be done via "weblogic.Admin GETSTATE"....but it is not working for me(might be I am doing something wrong)... (2 Replies)
Discussion started by: joshilalit2004
2 Replies

4. Solaris

Problem in deployment in weblogic server in solaris

I am getting following error during deployment in solaris. when i deploy same war in other machine (non-solaris) it works fine. the stacktrace is < ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1277738498407> <BEA-149205> <Failed to initialize the... (0 Replies)
Discussion started by: paradesi143
0 Replies

5. UNIX and Linux Applications

Exception in Weblogic Application server

Hi, I have a application running on weblogic server. i am getting these errors in logs very frequently. Could you please suggest any solution for this. -02-09 10:02:32,346 ERROR psn.properties.RemotePropertiesCache - Error occurred while attempting to retrieve property: ... (0 Replies)
Discussion started by: Siddheshk
0 Replies

6. UNIX and Linux Applications

Version of Weblogic server

Hi All, How to find the version of the weblogic server configured? Our server is a Linux based server. Regards Dhivya (1 Reply)
Discussion started by: dhivya.enjoy
1 Replies
R2E(1)							      General Commands Manual							    R2E(1)

NAME
r2e - receive RSS feeds by email SYNOPSIS
r2e [-d dir] action [options] DESCRIPTION
r2e is a simple program which you can run in your crontab. It watches RSS feeds and sends you nicely formatted email message for each new item. The program is configured by ~/.rss2email/config.py by default. To use a different config file in a different directory, you can specify the -d option before any actions. For a quick start with r2e, try these steps: r2e new your@address r2e add http://feed.url/somewhere.rss r2e run The last command should eventually be put into your crontab, if you want things be sent you automatically. It is possible to use authenticated feeds using the following syntax: r2e add http://user:password@example.com/feed ACTIONS
new [youremail] Create a new feedfile. If the second option is specified, it sets the default email address that mails are sent to. add url [youremail] Subscribe to a feed. The first option is the URL of the feed. The optional second option is the email address to send new items to. Repeat for each feed you want to subscribe to. run [--no-send] [num] Scan the feeds and send emails for new items. This can be run in a cron job. The --no-send option stops r2e from sending any email. This can be useful the first time you run it, as otherwise it would send every available story. If a number is specified, r2e will only download that feed. The list command lists the feed numbers. email yournewemail Change the default email address. list List all your currently subscribed feeds. delete n Delete a feed, using its number from the list command. pause n Temporarily ignore a feed. A paused feed won't be updated at all. unpause n Re-enable updates from a feed. opmlimport url Import feeds from an OPML file. opmlexport Export feeds to standard output, as an OPML file. CONFIGURATION
The program's behavior can be controlled via the ~/.rss2email/config.py config file. The file is a python file, so variables are set using a syntax like this: VARIABLE = "value" If the value is a number, the quotes may be omitted. Most configuration variables in the file are boolean values, where a 1 indicates the option is set, and a 0 disables it. See the example config.py file for a full list of available configuration variables. FILES
~/.rss2email/feeds.dat The database of feeds. Use r2e to add, remove, or modify feeds, do not edit it directly. ~/.rss2email/config.py If this file exists, it it read to configure the program. AUTHOR
Aaron Swartz <rss2email@aaronsw.com> R2E(1)
All times are GMT -4. The time now is 03:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy