Sponsored Content
Top Forums Shell Programming and Scripting Conditional Execution of a Script. Post 302797297 by Subbeh on Monday 22nd of April 2013 09:31:20 AM
Old 04-22-2013
if dbquery1 returns a returncode, you can use it for the second script:

Code:
./dbquery1.sh
if [[ $? -eq 0 ]] ; then
echo "Calling dbquery2.sh...."
./dbquery2.sh
fi

or
Code:
./dbquery1.sh && ./dbquery2.sh

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Conditional Date Script

I am learning Unix for the first time. I am playing around with my default profile file to add some script in the KSH. The time format is GMT and I am in eastern time zone. I am trying to script some greetings based upon the time of day using the IF/ELIF conditions. I am getting errors. I have... (2 Replies)
Discussion started by: cpd259
2 Replies

2. Shell Programming and Scripting

Conditional execution and parallel jobs

how can i process jobs parallel with conditions below. Script1.ksh Script2.ksh Script3.ksh Script4.ksh Script5.ksh Script6.ksh Script7.ksh Script8.ksh Script9.ksh Script10.ksh After successful completion of Script1.ksh I need to run Script7.ksh. After successful... (4 Replies)
Discussion started by: ford2020
4 Replies

3. Shell Programming and Scripting

unix script for conditional execution

Below is my shell script. I am trying to execute two different BTEQ scripts depending on the day of the week. So on a saturday I will execute a certain BTEQ script and on other weekdays I will run the other script. #!/bin/ksh dt=`date +"%a"` if then bteq > final_output <<- EOF .run... (3 Replies)
Discussion started by: Mihirjani
3 Replies

4. Shell Programming and Scripting

Help on shell script conditional execution when CPU Idle > 60%

I need a shell script that will monitor a few conditions and not execute until the these conditions are met. The problem I'm having is that I can not perform a database snapshot (backup) of a sybaseIQ database unless the CPU Status Idle % is above 60% or the snapshot (backup) fails. If... (2 Replies)
Discussion started by: pancona99
2 Replies

5. Shell Programming and Scripting

Conditional execution

Hi All, I want to echo a message in case a system is reachable by ping or echo a different message in case it's not reachable. Sample code i wrote is ping localhost -n 2 | grep 'ttl' > ping_op; ls ping_op > /dev/null && drReachable=Alive; echo -e `date`: \\t "DR server is reachable" >>... (5 Replies)
Discussion started by: Mr. Zer0
5 Replies

6. UNIX for Dummies Questions & Answers

Conditional execution of statements

Hi , I have a script which has multiple awk and sed commands like below. First one :- find /root/src/ -name "*csv" -size 0 -exec rm {} \; Second one: - ls *SRE*.txt > SRT_TRAN.dat rm *asr*.txt Third one :- find /root/src/ -name '*.csv' | while read FILENAME ; do awk... (2 Replies)
Discussion started by: shruthidwh
2 Replies

7. Shell Programming and Scripting

search and conditional execution

Hi, I have a list of files with different filenames like nam0001.txt,pan0001.txt etc coming in /data/inbox from various places. I needed a shell script which would:- 1)searches for a word from the filenames (coming in inbox directory) provided in input parameter. 2)if found, put in... (2 Replies)
Discussion started by: Saiesh
2 Replies

8. Shell Programming and Scripting

Conditional execution

Here's an interesting (to me, anyway) little puzzle. Background: I have a process that restores a number of large(ish) files from tape backup. As an individual file is being written, it is owned by root, then the ownership is changed when that file is complete. Since this process can take... (3 Replies)
Discussion started by: edstevens
3 Replies

9. UNIX for Dummies Questions & Answers

Conditional Script

Hi, I have a script file which has some simple commands. I want these commands to be executed based on the input. Ia m good with IF statement also. At the end it has to be based on incoming value. Example CASE 1 : Execute some commands where Input value as 1 CASE 2 : Execute... (5 Replies)
Discussion started by: vrupatel
5 Replies

10. UNIX for Dummies Questions & Answers

Bashrc File - Conditional Command Execution?

Hello All, I was wondering if there is a way to execute a command in my ".bashrc" file based on how I logged into the PC? I was thinking maybe there is a way to check how the user (*myself) logged in, maybe somehow with the who command along with something else, but I'm not sure... I know I... (7 Replies)
Discussion started by: mrm5102
7 Replies
Test::LeakTrace(3pm)					User Contributed Perl Documentation				      Test::LeakTrace(3pm)

NAME
Test::LeakTrace - Traces memory leaks VERSION
This document describes Test::LeakTrace version 0.14. SYNOPSIS
use Test::LeakTrace; # simple report leaktrace{ # ... }; # verbose output leaktrace{ # ... } -verbose; # with callback leaktrace{ # ... } sub { my($ref, $file, $line) = @_; warn "leaked $ref from $file line "; }; my @refs = leaked_refs{ # ... }; my @info = leaked_info{ # ... }; my $count = leaked_count{ # ... }; # standard test interface use Test::LeakTrace; no_leaks_ok{ # ... } 'no memory leaks'; leaks_cmp_ok{ # ... } '<', 10; DESCRIPTION
"Test::LeakTrace" provides several functions that trace memory leaks. This module scans arenas, the memory allocation system, so it can detect any leaked SVs in given blocks. Leaked SVs are SVs which are not released after the end of the scope they have been created. These SVs include global variables and internal caches. For example, if you call a method in a tracing block, perl might prepare a cache for the method. Thus, to trace true leaks, "no_leaks_ok()" and "leaks_cmp_ok()" executes a block more than once. INTERFACE
Exported functions "leaked_info { BLOCK }" Executes BLOCK and returns a list of leaked SVs and places where the SVs come from, i.e. "[$ref, $file, $line]". "leaked_refs { BLOCK }" Executes BLOCK and returns a list of leaked SVs. "leaked_count { BLOCK }" Executes BLOCK and returns the number of leaked SVs. "leaktrace { BLOCK } ?($mode | &callback)" Executes BLOCK and reports leaked SVs to *STDERR. Defined $modes are: -simple Default. Reports the leaked SV identity (type and address), file name and line number. -sv_dump In addition to -simple, dumps the sv content using "sv_dump()", which also implements "Devel::Peek::Dump()". -lines In addition to -simple, prints suspicious source lines. -verbose Both -sv_dump and -lines. "no_leaks_ok { BLOCK } ?$description" Tests that BLOCK does not leaks SVs. This is a test function using "Test::Builder". Note that BLOCK is called more than once. This is because BLOCK might prepare caches which are not memory leaks. "leaks_cmp_ok { BLOCK } $cmp_op, $number, ?$description" Tests that BLOCK leaks a specific number of SVs. This is a test function using "Test::Builder". Note that BLOCK is called more than once. This is because BLOCK might prepare caches which are not memory leaks. "count_sv()" Counts all the SVs in the arena. Script interface Like "Devel::LeakTrace" "Test::LeakTrace::Script" is provided for whole scripts. The arguments of "use Test::LeakTrace::Script" directive is the same as "leaktrace()". $ TEST_LEAKTRACE=-sv_dump perl -MTest::LeakTrace::Script script.pl $ perl -MTest::LeakTrace::Script=-verbose script.pl #!perl # ... use Test::LeakTrace::Script sub{ my($ref, $file, $line) = @_; # ... }; # ... EXAMPLES
Testing modules Here is a test script template that checks memory leaks. #!perl -w use strict; use constant HAS_LEAKTRACE => eval{ require Test::LeakTrace }; use Test::More HAS_LEAKTRACE ? (tests => 1) : (skip_all => 'require Test::LeakTrace'); use Test::LeakTrace; use Some::Module; leaks_cmp_ok{ my $o = Some::Module->new(); $o->something(); $o->something_else(); } '<', 1; DEPENDENCIES
Perl 5.8.1 or later, and a C compiler. CAVEATS
"Test::LeakTrace" does not work with "Devel::Cover" and modules which install their own "runops" routines, or the perl executor. So if the test functions of this module detect strange "runops" routines, they do nothing and report okay. BUGS
No bugs have been reported. Please report any bugs or feature requests to the author. SEE ALSO
Devel::LeakTrace. Devel::LeakTrace::Fast. Test::TraceObject. Test::Weak. For guts: perlguts. perlhack. sv.c. AUTHOR
Goro Fuji(gfx) <gfuji(at)cpan.org>. LICENSE AND COPYRIGHT
Copyright (c) 2009-2010, Goro Fuji(gfx). All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-10-07 Test::LeakTrace(3pm)
All times are GMT -4. The time now is 09:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy