Sponsored Content
Full Discussion: Modifying the Restart Script
Top Forums Shell Programming and Scripting Modifying the Restart Script Post 302526949 by Siddheshk on Thursday 2nd of June 2011 03:10:39 AM
Old 06-02-2011
Hi,

Sometime it may happen that the shepherd process may not stop. so be sure it is stops i was willing to put a loop to check the same, then start the shepherd process

Siddhesh.K

---------- Post updated at 12:40 PM ---------- Previous update was at 12:39 PM ----------

The original file looks like this.

Code:
stop_shepherd() {
        . $PROFILE
    echo "Stopping shepherd processes"
    PID=`cat $SERVER_HOME/alerts/logs/shepherd.pid`
    ps -ef | grep shep-1 | grep -v grep | grep -v wls100ctl | awk '{print $2}' > $SERVER_HOME/tmp/shepherd.pids
    if [ -s $SERVER_HOME/tmp/shepherd.pids ]
    then
        cat $SERVER_HOME/tmp/shepherd.pids | xargs kill -9
        echo "Shepherd stopped"
        rm -f $SERVER_HOME/tmp/shepherd.pids
    else
        echo "Shepherd not running"
    fi
    }

start_shepherd() {
        . $PROFILE
        echo "Starting shepherd processes"
        ps -ef | grep shep-1 | grep -v grep | grep -v wls100ctl | awk '{print $2}' > $SERVER_HOME/tmp/shepherd.pids
        if [ -s $SERVER_HOME/tmp/shepherd.pids ]
        then
        echo "Shepherd already running"
                rm -f $SERVER_HOME/tmp/shepherd.pids
        else
            cd $SERVER_HOME/alerts/bin
            su - shep-1 ./shepherd.sh
        rm -f $SERVER_HOME/tmp/shepherd.pids
        echo "Shepherd started"
        fi
    }


Last edited by Franklin52; 06-02-2011 at 10:31 AM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need help with understanding and modifying script

hi all, i am new to UNIX. this is my first time using Ubuntu. i need to do this for my fyp. i am using an artificial neural network model to predict the yield strength of steel. the shell script used to execute this model is as shown here: #Thomas Sourmail, Cambridge University /... (4 Replies)
Discussion started by: dakkorn
4 Replies

2. Shell Programming and Scripting

Help modifying script to loop through all folders

I have this script someone very kindly help me write last year which loops through all files in a folder and does a command. I need to modify it to loop through all sub-folders of a main folder and only perform the command on files modified after Jan 1st 2008. And I need the command to place the... (3 Replies)
Discussion started by: Fred Goldman
3 Replies

3. Shell Programming and Scripting

Modifying a .ksh script

Hi users, I am on a beginner level and just joined this site. I have created a simple .ksh file in the following manner cat <<EOF >mfile #!/bin/ksh echo "hello world" EOF Request for some help with 2 cases 1. now i would like to add a second line after the first echo command... (4 Replies)
Discussion started by: corbusier
4 Replies

4. Shell Programming and Scripting

Modifying the ntpd deamon script

I need to replace the line daemon ntpd $OPTIONS in the following script with daemon ntpd $OPTIONS 2>&1 > /var/log/ntpd.log & what will happen? The idea of replacing is to capture the output on the console into ntpd.log file. Will this work? ... (1 Reply)
Discussion started by: naive1977
1 Replies

5. Shell Programming and Scripting

modifying perl script

Hi freinds I have a small problem I want u to help me in, I have a syslog server and configured it to send me email automatically, I get a small perl script to help me in, and tested it to send alerts to root and it worked successfully without any problems Now I want to send it outside, I... (4 Replies)
Discussion started by: reaky
4 Replies

6. Shell Programming and Scripting

modifying file using script

Hi, I am new to shell programming, and want to know is it possible to change the contents of file using script? for example, if want to search 2 words and want to replace these words with 2 new words. Regards, Manoj (4 Replies)
Discussion started by: manoj.solaris
4 Replies

7. UNIX for Dummies Questions & Answers

Modifying a shell script without using an editor

Hi all, I really wan't to know that how to edit a shell script with out using an editor.. Is there any command? (4 Replies)
Discussion started by: buddhi
4 Replies

8. Shell Programming and Scripting

awk script for modifying the file

I have the records in the format one row 0009714494919I MY010727408948010 NNNNNN N PUSAAR727408948010 R007YM08705 9602002 S 111+0360832-0937348 I want to get it int the format 0009714494919I MY010727408948010 NNNNNN N PUSAAR727408948010 R007YM08705 9602002 S ... (2 Replies)
Discussion started by: sonam273
2 Replies

9. Shell Programming and Scripting

Need some help modifying script

I have a script that currently runs fine and I need to add or || (or) condition to the if statement and I'm not sure the exact syntax as it relates to the use of brackets. my current script starts like this: errLog="/usr/local/website-logs/error.log" apacheRestart="service httpd restart"... (3 Replies)
Discussion started by: jjj0923
3 Replies

10. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies
Test::Script(3) 					User Contributed Perl Documentation					   Test::Script(3)

NAME
Test::Script - Basic cross-platform tests for scripts DESCRIPTION
The intent of this module is to provide a series of basic tests for 80% of the testing you will need to do for scripts in the script (or bin as is also commonly used) paths of your Perl distribution. Further, it aims to provide this functionality with perfect platform-compatibility, and in a way that is as unobtrusive as possible. That is, if the program works on a platform, then Test::Script should always work on that platform as well. Anything less than 100% is considered unacceptable. In doing so, it is hoped that Test::Script can become a module that you can safely make a dependency of all your modules, without risking that your module won't on some platform because of the dependency. Where a clash exists between wanting more functionality and maintaining platform safety, this module will err on the side of platform safety. FUNCTIONS
script_compiles script_compiles( 'script/foo.pl', 'Main script compiles' ); The "script_compiles" test calls the script with "perl -c script.pl", and checks that it returns without error. The path it should be passed is a relative unix-format script name. This will be localised when running "perl -c" and if the test fails the local name used will be shown in the diagnostic output. Note also that the test will be run with the same perl interpreter that is running the test script (and not with the default system perl). This will also be shown in the diagnostic output on failure. script_runs script_runs( 'script/foo.pl', 'Main script runs' ); The "script_runs" test executes the script with "perl script.pl" and checks that it returns success. The path it should be passed is a relative unix-format script name. This will be localised when running "perl -c" and if the test fails the local name used will be shown in the diagnostic output. The test will be run with the same perl interpreter that is running the test script (and not with the default system perl). This will also be shown in the diagnostic output on failure. SUPPORT
All bugs should be filed via the bug tracker at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Script <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Script> For other issues, or commercial enhancement and support, contact the author. AUTHOR
Adam Kennedy <adamk@cpan.org> SEE ALSO
prove, <http://ali.as/> COPYRIGHT
Copyright 2006 - 2009 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.16.2 2009-11-23 Test::Script(3)
All times are GMT -4. The time now is 01:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy