Script for Rebooting infa servers


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script for Rebooting infa servers
# 1  
Old 08-01-2011
Script for Rebooting infa servers

Hi,
I am new to unix, trying to learn things
I have written unix script to stop Informatica server and re-start them.
In order to stop the servers i need to check the below
1. Check if the infa servers are already running.
2. If the servers are already running then, i need to stop the servers.
3. If the servers are not running then exit.
4. Once the servers are stopped, check if the they stopped successfull.
5. If not forcefull shutdown the servers.

Below is the script for checking the services are running or not.

Defined all the variable

Code:
#*********Check whether the Integration services is still running*************
ps -ef| grep $username | grep $INFA_INT_SERVICE | grep -vq grep
if [ $? -eq 1 ]
then
#exit 1
error_flag1=1
fi
#********** Check to see if Repository Service is still running**************
ps -ef| grep $username | grep $INFA_REPO_SERVICE | grep -vq grep
if [ $? -eq 1 ]
then
echo "$datetimestamp: $INFA_REPO_SERVICE is not running" 
error_flag2=2
fi
#***********To check whether the informatica Domain is still running**********
ps -ef| grep $username | grep $INFA_DOMAIN | grep -vq grep
if [ $? -eq 1 ]
then
error_flag3=3
fi
 
if [[ $error_flag1 -eq 1 && $error_flag2 -eq 2 && $error_flag3 -eq 3 ]]
then
echo "Informatica services are not running"
exit 1
fi

The script is working fine as excepted.
I wanted to know if it can be fine tuned. Is the error handling process is correct.

And also
when i am doing pidof DINFA_DOMAINS_FILE
its returing null.

Please suggest.

Moderator's Comments:
Mod Comment Please use [CODE] tags when posting source listings, console output, ...

Last edited by pludi; 08-01-2011 at 04:15 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Call one script from other script lying on different servers.

HI All, I have a requirement of execueting a Shell script on serverA, which is going to execute an application script ( Hyperian Planning script ) on serverB. Can any one please help in how to achieve this? e.g. script abc.ksh runs on serverA. internally abc.ksh call a script... (3 Replies)
Discussion started by: alok2082
3 Replies

2. Shell Programming and Scripting

Exit the script when all servers are down

Hello All, I have a script which needs to exit once it encounters that all the servers are down. In the below portion of a code the content manager is having values of server for example server A , server B. So I want the script to exit only if all the servers are down and to continue if one... (4 Replies)
Discussion started by: Vikram_Tanwar12
4 Replies

3. Shell Programming and Scripting

Need bash script to ping the servers and rename the output file each time the script is ran

HI, I have a file serverlist in that all host names are placed. i have written a small script #./testping #! /bin/bash for i in `cat serverlist` do ping $i >> output.txt done so now it creates a file output.txt till here fine.. now each time i run this script the output file... (4 Replies)
Discussion started by: madhudeva
4 Replies

4. Shell Programming and Scripting

Machine rebooting when shell script is killed

I am trying to kill a shell script by grepping it, but the machine is being shutdown totally when i kill it Below is the code kill `ps -ef |grep test.sh| grep -v grep` stat=$? if # check the return code then echo " script killed at $(date +%D@%T) " else echo " script... (5 Replies)
Discussion started by: venu
5 Replies

5. Shell Programming and Scripting

process id of infa Domain

Hi All, I am trying to get the process id of informatica Domain I used the below query : pidof DINFA_DOMAINS_FILE its not returing any result, when i try this ps -ef | grep DINFA_DOMAINS_FILE the result is displayed as below with process id xxxx 912 1 3 Jul24 ? ... (2 Replies)
Discussion started by: ch33ry
2 Replies

6. Shell Programming and Scripting

df -kh on 30+ servers using script?

It feels like I have taken on to of a big task.. but I want to learn but dont know where to start.. Rome wasnt built in one day right.. I have around 30+ servers running linux/unix flavours and need to be able to do this in a script that will be a cronjob. - ssh to all 30+ servers - do df -kh... (3 Replies)
Discussion started by: ebolasmurf
3 Replies

7. Linux

Rebooting Mounted servers

Hi All, We have two servers DSERV1(red hat 8.0) and DSERV2(scounix 3.2) where DSERV1 is the NFS server and DSERV2 is the NFS client. We want to reboot these servers and wanted to know the steps(precautions) we have to follow in order to do this. After reboot should we do anything specific to... (2 Replies)
Discussion started by: jisha
2 Replies

8. Shell Programming and Scripting

How to call the ksh script when rebooting the server

Hi all, Can any one help me....... I just want to run one shell script whenever i am rebooting the server. Is there any easy way to do that???? Thanks, selva (7 Replies)
Discussion started by: Selva_Kumar
7 Replies

9. Shell Programming and Scripting

script to locate servers

I am a newbie in shell scripting and I need to produce a script to work and achieve the following: 1) Look into the file /etc/defaultrouter , and store the value in it 2) If the value is a number, go to LIST and print out the second column corresponding to the value.(eg London) 3) If the... (5 Replies)
Discussion started by: ibroxy
5 Replies

10. UNIX for Dummies Questions & Answers

3 servers 1 .ksh script

system = AIX How can I explain this..... Keep in mind I do not want to login to the boxes, persay, and that I am fairly new to scripting and unix. I want to use SSH. I have a script on server1, this is where I want it to run from. I have server2 and server3, where I want the script to... (2 Replies)
Discussion started by: cml2008
2 Replies
Login or Register to Ask a Question