Sponsored Content
Top Forums Shell Programming and Scripting Script to Start services based on dependent services on other AIX machine Post 302873233 by draghun9 on Monday 11th of November 2013 11:29:31 AM
Old 11-11-2013
Script to Start services based on dependent services on other AIX machine

Hi,
I just started working on a script. After my research, i found a command which can help me:
AIM: To build a script which starts the services (Services 1) on server 1 automatically whenever its down. And it has a dependency on other service (Service 2) on Server 2.

So my script has to check if service 2 is up and running on other machine and only then has to start Service 1. I cannot use any passwords in the script or do not any a ID with no password required ability to login to other machine using ssh and check the status of the service 2.

So my IDEA is, Service 2 always uses particular port X...so my script which stays on server 1 has to just check if port X is in use, if so just go ahead and start service 1. If not wait for sometime till service 2 is up and then start service 1.

Please help...

I think i can use IF statement and then put nc command and based on its put start service 1. Any thought/help will be really appreciated.
 

10 More Discussions You Might Find Interesting

1. Solaris

Start Up Services?

Solaris uses a few different mechanisms to start up services and processes at boot time. Where do all the running processes come from? Can you find from where they were started? (8 Replies)
Discussion started by: gc40
8 Replies

2. SuSE

start services during the startup

I'm trying to add services to start services automatically during the system start up in suse linux. I followed these steps.. chkconfig servicename on and created symbolic link at /etc/rc.d/rc3.d/ folder with name S80servicename. here is the command I used ln -s /etc/init.d/servicename... (8 Replies)
Discussion started by: s_linux
8 Replies

3. Solaris

Re:How to enable samba services on solaries8 machine

Hi all, can any one guide me to configure samba services on solaries8 machine and how to use at the client side (i,e) how the client can retrive the data using samba services. Thanks venky (2 Replies)
Discussion started by: venky_vemuri
2 Replies

4. HP-UX

Couldn't start nrpe services (Unknown service)

Good morning, I've installed nrpe 2.12 (from nagios) on a HP-UX B.11.11 U server! Then I've configured the following files : $ tail /etc/services nrpe 5666/tcp # NRPE $ tail /etc/inetd.conf nrpe stream tcp nowait nagios /software/nagios/nrpe/bin/nrpe -c... (0 Replies)
Discussion started by: hiddenshadow
0 Replies

5. Shell Programming and Scripting

Services Start & stop scripts--help required

Dear All, Pls find my scripts for Agent services strat & stop. EAMSROOT=/opt/panaces export EAMSROOT cd $EAMSROOT nohup ./OracleAgent.sh start & nohup ./PFRAgent.sh start & nohup ./PFR.sh start & nohup ./SolarisOSAgent.sh start & exit 0 EAMSROOT=/opt/panaces export EAMSROOT cd... (0 Replies)
Discussion started by: starnaresh
0 Replies

6. UNIX for Advanced & Expert Users

start some services automatically

Hello All i have a question related to some services,i want to start some services with server linux centos. i make "chkconfig httpd on" and "chkconfig asterisk on",but when i verify with chkconfig --list i found httpd 0: off 1: off 2: on 3: on 4: on 5: on 6:... (6 Replies)
Discussion started by: bernard12
6 Replies

7. Red Hat

Restart of services if port no is changed in /etc/services in RHEL

I had a doubt if any services need to be restarted if port no in /etc/services in an RHEL setup is changed. For eg, the port no of 443 for SSL may need to be changed. I hope my query is clear whether any services need to be restarted if port no in /etc/services is changed. Please revert with... (10 Replies)
Discussion started by: RHCE
10 Replies

8. Solaris

How to configure start up services/processes in Solaris 10?

I normally use "chkconfig" to configure start up services in a particular run level..... But i don't know how to do it in solaris 10.... please help me !!! (2 Replies)
Discussion started by: vamshigvk475
2 Replies

9. AIX

Thoughts on HACMP: Automatic start of cluster services

Hi all, I remember way back in some old environment, having the HA cluster services not being started automatically at startup, ie. no entry in /etc/inittab. I remember reason was (taken a 2 node active/passive cluster), to avoid having a backup node being booted, so that it will not... (4 Replies)
Discussion started by: zaxxon
4 Replies

10. UNIX for Beginners Questions & Answers

Start Services in Clustered Environment

Hello Experts, I have a requirement to start and stop weblogic services in a clustered environment. First i need to start weblogic server and once the server is in Running mode i need to do SSH to other server and there i need to start Node Manager and Managed server, After these two are in... (1 Reply)
Discussion started by: beginner786
1 Replies
sv(8)                                                         System Manager's Manual                                                        sv(8)

NAME
sv - control and manage services monitored by runsv(8) SYNOPSIS
sv [-v] [-w sec] command services /etc/init.d/service [-w sec] command DESCRIPTION
The sv program reports the current status and controls the state of services monitored by the runsv(8) supervisor. services consists of one or more arguments, each argument naming a directory service used by runsv(8). If service doesn't start with a dot or slash and doesn't end with a slash, it is searched in the default services directory /etc/service/, otherwise relative to the current directory. command is one of up, down, status, once, pause, cont, hup, alarm, interrupt, 1, 2, term, kill, or exit, or start, stop, restart, shutdown, force-stop, force-reload, force-restart, force-shutdown. The sv program can be sym-linked to /etc/init.d/ to provide an LSB init script interface. The service to be controlled then is specified by the base name of the ``init script''. COMMANDS
status Report the current status of the service, and the appendant log service if available, to standard output. up If the service is not running, start it. If the service stops, restart it. down If the service is running, send it the TERM signal, and the CONT signal. If ./run exits, start ./finish if it exists. After it stops, do not restart service. once If the service is not running, start it. Do not restart it if it stops. pause cont hup alarm interrupt quit 1 2 term kill If the service is running, send it the STOP, CONT, HUP, ALRM, INT, QUIT, USR1, USR2, TERM, or KILL signal respectively. exit If the service is running, send it the TERM signal, and the CONT signal. Do not restart the service. If the service is down, and no log service exists, runsv(8) exits. If the service is down and a log service exists, send the TERM signal to the log service. If the log service is down, runsv(8) exits. This command is ignored if it is given to an appendant log service. sv actually looks only at the first character of these commands. Commands compatible to LSB init script actions status Same as status. start Same as up, but wait up to 7 seconds for the command to take effect. Then report the status or timeout. If the script ./check exists in the service directory, sv runs this script to check whether the service is up and available; it's considered to be avail- able if ./check exits with 0. stop Same as down, but wait up to 7 seconds for the service to become down. Then report the status or timeout. reload Same as hup, and additionally report the status afterwards. restart Send the commands term, cont, and up to the service, and wait up to 7 seconds for the service to restart. Then report the status or timeout. If the script ./check exists in the service directory, sv runs this script to check whether the service is up and avail- able again; it's considered to be available if ./check exits with 0. shutdown Same as exit, but wait up to 7 seconds for the runsv(8) process to terminate. Then report the status or timeout. force-stop Same as down, but wait up to 7 seconds for the service to become down. Then report the status, and on timeout send the service the kill command. force-reload Send the service the term and cont commands, and wait up to 7 seconds for the service to restart. Then report the status, and on timeout send the service the kill command. force-restart Send the service the term, cont and up commands, and wait up to 7 seconds for the service to restart. Then report the status, and on timeout send the service the kill command. If the script ./check exists in the service directory, sv runs this script to check whether the service is up and available again; it's considered to be available if ./check exits with 0. force-shutdown Same as exit, but wait up to 7 seconds for the runsv(8) process to terminate. Then report the status, and on timeout send the ser- vice the kill command. try-restart if the service is running, send it the term and cont commands, and wait up to 7 seconds for the service to restart. Then report the status or timeout. Additional Commands check Check for the service to be in the state that's been requested. Wait up to 7 seconds for the service to reach the requested state, then report the status or timeout. If the requested state of the service is up, and the script ./check exists in the service direc- tory, sv runs this script to check whether the service is up and running; it's considered to be up if ./check exits with 0. OPTIONS
-v If the command is up, down, term, once, cont, or exit, then wait up to 7 seconds for the command to take effect. Then report the status or timeout. -w sec Override the default timeout of 7 seconds with sec seconds. This option implies -v. ENVIRONMENT
SVDIR The environment variable $SVDIR overrides the default services directory /etc/service/. SVWAIT The environment variable $SVWAIT overrides the default 7 seconds to wait for a command to take effect. It is overridden by the -w option. EXIT CODES
sv exits 0, if the command was successfully sent to all services, and, if it was told to wait, the command has taken effect to all ser- vices. For each service that caused an error (e.g. the directory is not controlled by a runsv(8) process, or sv timed out while waiting), sv increases the exit code by one and exits non zero. The maximum is 99. sv exits 100 on error. If sv is called with a base name other than sv: it exits 1 on timeout or trouble sending the command; if the command is status, it exits 3 if the service is down, and 4 if the status is unknown; it exits 2 on wrong usage, and 151 on error. SEE ALSO
runsv(8), chpst(8), svlogd(8), runsvdir(8), runsvchdir(8), runit(8), runit-init(8) http://smarden.org/runit/ AUTHOR
Gerrit Pape <pape@smarden.org> sv(8)
All times are GMT -4. The time now is 03:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy