Sponsored Content
Top Forums Shell Programming and Scripting Stopping Start/Stop scripts in reverse order Post 302083381 by madasafish on Saturday 5th of August 2006 09:25:34 AM
Old 08-05-2006
Stopping Start/Stop scripts in reverse order

#Define the Start/Stop/Status Scripts to include
SSS_SCRIPTS=( prog1 prog2 prog3 etc...... )

#Start the scripts
StartScripts()
{
for SSS in ${SSS_SCRIPTS[*]}
do
./$SSS start
done
}

#Stop the Scripts
StopScripts()
{
for SSS in ${SSS_SCRIPTS[*]}
do
./$SSS stop #<---I want it to stop in reverse order eg: Prog3 Prog2 Prog1....
done

Any help appreciated

madasafish
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Start and stop of an application thru shell scripts.

Hi, I just learnt the shell scripting and got working on that right now. I have one problem. Here i am having a java application that needs to be start and stop using two shell scripts, i.e., starting the java application using one shell script and stopping the application using another... (1 Reply)
Discussion started by: sadha
1 Replies

2. UNIX for Dummies Questions & Answers

sort -reverse order

I need to sort the particular column only in reverse order how i can give it.. if i give the -r option the whole file is getting sorted in reverse order. 1st 2nd col 3rd C col 4th col 5th col ------------------------------------------- C... (7 Replies)
Discussion started by: sivakumar.rj
7 Replies

3. 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

4. AIX

Please update inittab/rc.shutdown/rc scripts to start/stop mqm (need help Urgent)

HI i need help from seniors on this issue, i need to know how to do this, i need to update 50+ server starting saturday. below is the ticket which i have with full description. Currently MQ Series must be stopped before and started after any reboot. Not having the start/stop as part of... (2 Replies)
Discussion started by: gulamibrahim
2 Replies

5. Shell Programming and Scripting

How to get fields in reverse order?

i am having lines like below seperated by "|" (pipe) abc|xyz 123|567 i have to get the above in reverse order xyz|abc 567|123 Pls help (5 Replies)
Discussion started by: suryanarayana
5 Replies

6. UNIX for Dummies Questions & Answers

printing fields in reverse order

command/script(apart from awk) to print the fields in reverse order that is last field has to come first and so on and first field has to go last Input store-id date sale ............. ............. ... (3 Replies)
Discussion started by: tsurendra
3 Replies

7. Shell Programming and Scripting

print in reverse order

Hi, I want to print the item in reverse order such that the output would look like 00 50 50 23 40 22 02 96 Below is the input: 00 05 05 32 04 22 20 69 Video tutorial on how to use code tags in The UNIX and Linux Forums. (5 Replies)
Discussion started by: reignangel2003
5 Replies

8. Shell Programming and Scripting

Delete records in reverse order

Hi all, i have dynamic file 'xyz.txt', records always look likes below format ... 0000021 RET 31-MAR-1984 FAP 0000021 DTA 14-JAN-2003 CNV 0000021 DTA 25-MAR-2012 DTA 0000021 DTA 26-MAR-2012 DTA ################################################# 0000021 DTA ... (4 Replies)
Discussion started by: krupasindhu18
4 Replies

9. Red Hat

[HA] Red Hat 7, pacemaker and start/stop scripts

Hi there, I am wondering if I could add start/stop ksh scripts provided by 3rd party to cluster... I read that script must be ocf/lsb compliant, however, in AIX I can just set up two separate scripts for starting and stopping application. Can similar be done under RH Linux cluster? Cheers, c (1 Reply)
Discussion started by: cyjan
1 Replies
INSSERV(8)						      System Manager's Manual							INSSERV(8)

NAME
insserv - boot sequence organizer using LSB init.d script dependency information SYNOPSIS
insserv [-v] [-c <config>] [-p <path>] [-d] [-f] [[/]path/to/init.d/]script ... insserv [-v] [-c <config>] [-p <path>] [[/]path/to/init.d/]script[,start=<lvl1,lvl2,...>,stop=<lvl1,lvl2,...>] insserv [-v] [-c <config>] [-p <path>] -r [-d] [-f] [[/]path/to/init.d/]script ... insserv -h DESCRIPTION
insserv is a low level tool used by update-rc.d which enables an installed system init script (`boot script') by reading the comment header of the script, e.g.: ### BEGIN INIT INFO # Provides: boot_facility_1 [ boot_facility_2 ...] # Required-Start: boot_facility_1 [ boot_facility_2 ...] # Required-Stop: boot_facility_1 [ boot_facility_2 ...] # Should-Start: boot_facility_1 [ boot_facility_2 ...] # Should-Stop: boot_facility_1 [ boot_facility_2 ...] # X-Start-Before: boot_facility_1 [ boot_facility_2 ...] # X-Stop-After: boot_facility_1 [ boot_facility_2 ...] # Default-Start: run_level_1 [ run_level_2 ...] # Default-Stop: run_level_1 [ run_level_2 ...] # X-Interactive: true # Short-Description: single_line_description # Description: multiline_description ### END INIT INFO and calculating the dependencies between all scripts. It is not recommended to execute insserv directly unless you know exactly what you're doing, doing so may render your boot system inoperable. update-rc.d is the recommended interface for managing init scripts. Please be aware that the line # Required-Stop: boot_facility_1 [ boot_facility_2 ...] declares facilities which must be available during shutdown of the service declared in the Provides tag. Same holds true for # Should-Stop: boot_facility_1 [ boot_facility_2 ...] which declares facilities which should be available during shutdown of the service declared in the Provides tag. In both cases the script system should avoid stopping services which are declared by these two Stop tags until the script including these tags is stopped. The optional X-Interactive keyword implies that the script using this keyword should be started alone in a concurrent boot configuration because it interact with the user at the console. Only the value `true' is recognised. All other are ignored. The optional X-Start-Before keyword implies that the script using this keyword should be started before the specified service names. Whereas the optional X-Stop-After keyword implies that the script using this keyword should be stopped after the specified service names. Both implies that those services now depend on the specifying script. With known dependencies and runlevel(s) insserv sets and reorders the corresponding symbolic links of the concerned runlevels directories. insserv scans for System Facilities in the configuration file /etc/insserv.conf and each file in the directory /etc/insserv.conf.d/. Each line which begins with $ and a following name defines a system facility accordingly to the Linux Standard Base Specification (LSB), All names followed by such a system facility will declare the required dependencies of the facility. Here is an example for /etc/insserv.conf: # All local filesystems are mounted # (done during boot phase) $local_fs boot # Low level networking $network network route # Named is operational $named named # All remote filesystems are mounted # (in some cases /usr may be remote). $remote_fs $local_fs nfs # System logger is operational $syslog syslog # All network daemons are running (This was removed in LSB 1.2) $netdaemons portmap inetd # Services which need to be interactive <interactive> boot.crypto Names starting with a `+' sign are marked as optional. If the service with the name after the plus sign is available it will be used, if not available it is ignored silently. Words beginning with < and ending with > are keywords. Currently <interactive> is the only know keyword for marking a service as an interactive one, e.g. a service which requires a passphrase or password input during boot or runlevel change. The special facility $null is used to enforce an empty dependency in case of Should-Stop and Required-Stop. In addition to the defined System Facilities in the configuration file /etc/insserv.conf, insserv also knows the special facility $all. This facility indicates that a service should be inserted at the end of all services at starting and at the very beginning at stopping. Clearly all services using this facility will be grouped into one starting or stopping order. OPTIONS
Currently there exists nine options for insserv. -v, --verbose Write out what is currently going on. -c <config>, --config <config> Specify path to the insserv.conf file and the insserv.conf.d directory. Useful for testing. -o <path>, --override <path> LSB comment headers found in this path will override existing LSB comment headers of scripts in the init.d directory (default path is /etc/insserv/overrides/). -p <path>, --path <path> Specify path to init.d directory. Useful for testing. -n, --dryrun Do not update symlinks. -r, --remove Remove the listed scripts from all runlevels. -d, --default Use default runlevels as defined in the scripts. This may restore an edited runlevel link scheme. -f, --force Ignore if a required service is missed. Beside this if start and or stop levels are specified on the command line the default levels of the script will be ignored. -u <path>, --upstart-job <path> Path to replace existing upstart job path. (default path is /lib/init/upstart-job). -s, --showall Output runlevel and sequence information. Do not update symlinks. -h, --help Print out short usage message. But you may use the argument syntax described in the following section. ARGUMENTS
[[/]path/to/init.d/] Relative or absolute path to the init scripts base directory. This defaults to /etc/init.d/ in compliance with the LSB specifica- tion. In this case insserv does not add or remove a script to the runlevels declared in the script headers, but may re-order the runlevels if the order of the currently enabled scripts has changed (see option -d). Note that if a relative path is used insserv has to be called from the root directory. [[/]path/to/init.d/]script ... List of scripts which have to be added to the runlevels. If a path is used it should point to the absolute or relative location of the boot scripts. insserv checks for the existence of these scripts. For the runlevels the information found in the script is used. [[/]path/to/init.d/]script[,start=<lvl1,lvl2,...>] List of scripts which have to be added to the specified runlevels to be started with. You may use this extension to override the default values for start and stop runlevels of the script. Note that lvl1, lvl2, ... are the known runlevels explained above. The extension ,stop=<lvl1,lvl2,...> is also possible. -r [[/]path/to/init.d/]script ... List of scripts which should be removed from the runlevels. If a path is used it should point to the absolute or relative location of the boot scripts. insserv checks for the existence of these scripts. OVERRIDES
Beside using the extensions ,start=<lvl1,lvl2,...> and ,stop=<lvl1,lvl2,...> it is possible to use override files replace a LSB comment header or simple provide a missing LSB comment header. This can be done by placing a file with the new LSB comment header using the same name as the boot or init script in the directory /etc/insserv/overrides/. For third party boot scripts without LSB header it is possible to add a file with the same name in the directory /usr/share/insserv/overrides/ to make them completely LSB compliant. UPSTART JOB COMPATIBILITY
To allow upstart jobs to work as init.d scripts, insserv will recognize a symlink from path/to/init.d/script to /lib/init/upstart-job as upstart jobs, and instead of reading the header from the file will run the script with the argument lsb-header to get the script header. EXIT CODES
The exit codes have the following conditions: 0 Service was successfully installed or removed 1 Service was not installed or removed NOTE
Please be aware that the following patterns of boot script file names will be not accepted by insserv: *.dpkg* *.rpm* *.ba* *.old *.new *.org *.orig *.save *.swp *.core *~ with the wildcard character *. Beside this all boot script file names beginning with one of the following characters $.#%_+-*[]^:()~ will be ignored. BUGS
Boot scripts sometimes lack a LSB comment header. Contact a package maintainer or developer of the software which provides the script to have a LSB comment header added to it. FILES
/etc/insserv.conf configuration file for insserv which defines the LSB System Facilities. /etc/insserv.conf.d/ directory for further configuration files for declaring LSB System Facilities. /etc/insserv/overrides/ path to replace existing LSB comment headers with the comment headers found in this path. /etc/init.d/ path to the init script base directory as required by the Linux Standard Base Specification (LSB). /etc/init.d/.depend.boot, /etc/init.d/.depend.start, /etc/init.d/.depend.stop The make(1) like dependency files produced by insserv for booting, starting, and stopping with the help of startpar(8). SEE ALSO
init(8), startpar(8), update-rc.d(8). COPYRIGHT
2000-2009 Werner Fink, 2009 SuSE Linux Products GmbH Nuernberg, Germany. 2000-2003 SuSE GmbH Nuernberg, Germany, 2007-2009 SuSE Linux Products GmbH Nuernberg, Germany. AUTHOR
Werner Fink <feedback@suse.de> CONTRIBUTORS
Petter Reinholdtsen Kel Modderman 3rd Berkeley Distribution Jul 29, 2008 INSSERV(8)
All times are GMT -4. The time now is 05:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy