Sponsored Content
Top Forums Shell Programming and Scripting How to call the System command twice in the same perl script... Post 302513918 by msrahman on Thursday 14th of April 2011 10:23:20 AM
Old 04-14-2011
How to call the System command twice in the same perl script...

Hello experts,
I have a perl script which looks for the ARGV and then loads the data as per it.
Example.
Code:
#Checking the server to connect
if ($ARGV[0] eq 'QA')
{
        $ENV{"ORACLE_HOME"} = "/oracle/product/11.2.0";
        $ENV{"PATH"} = "$ENV{'PATH'}:/oracle/product/11.2.0/bin";
        $ENV{"ORACLE_SID"} = "db112";
        #$dbsid = 'db111';
        $dbuser = 'zx####';
        #$dbpwd = `/usr/local/pl/perlencrypt.pl -k /kda1/system/ealgorithm -d /sdr1/system/db111zx####pw`;
}

Now i want to add the same for Prod, which i did;
Code:
#Checking the server to connect
if ($ARGV[0] eq 'QA')
{
        $ENV{"ORACLE_HOME"} = "/oracle/product/11.2.0";
        $ENV{"PATH"} = "$ENV{'PATH'}:/oracle/product/11.2.0/bin";
        $ENV{"ORACLE_SID"} = "db112";
        #$dbsid = 'db222';
        $dbuser = 'zx####';
        #$dbpwd = `/usr/local/pl/perlencrypt.pl -k /kda1/system/ealgorithm -d /sdr1/system/db222zx####pw`;
}

But the problem here is, i am using "system" command to call the sqlldr to load the data into QA tables.
Code:
$infile = $inputdirectory.$file;
print $infile;
#Logfile location where it will reside
$logFile = "/A/B/C/log/ZIP_code.log";
#Control file location
$confile = "/A/B/C/control/zip_codes_38.ctl";
print "$dbuser\n";
#print "$dbpwd\n";
system ("/usr/local/pl/perlencrypt.pl -k /kda1/system/ealgorithm -d /sdr1/system/db111zx####pw | sqlldr userid=$dbuser DATA=$infile control=$confile log=$log
File");

#This is the system command to call Sqlldr for Production.
system ("/usr/local/pl/perlencrypt.pl -k /kda1/system/ealgorithm -d /sdr1/system/db222zx####pw | sqlldr userid=$dbuser DATA=$infile control=$confile log=$log
File");[/CODE]
Can i use the same "System" command for Prod too? Will that work...?
Or, How should i use another ARGV for Production in the same perl script?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

a system call for sed in a awk script

Hi, this is my test file : DELETE FROM TABLE WHERE ID_INTERNAL = :TABLE.ID-INTERNAL, ID-INTERNAL-CRAZY ID-INTERNAL-OPEN ID-INTERNAL /ID-INTERNAL/ I want all occurences of ID-INTERNAL replaced with a one, if ID-INTERNAL has and dash afer it , dont replace it example:... (6 Replies)
Discussion started by: seaten
6 Replies

2. UNIX for Dummies Questions & Answers

how can call perl script as command?

Hello say i have written some perl scripts , now i like to call them in my unix shell as unix command like "more" , "ls" , "grep" so that my say perl script called "foo.pl" will be called from every where as "foo" or "foo arg1 arg2"? Thanks (1 Reply)
Discussion started by: umen
1 Replies

3. Programming

Need help with running the tar command using system() call in C

Hey everyone, I've been trying to use the system(cmd) call in C to tar multiple files together. When i do so i specify the absolute paths of the tar file as well as the files to be included in the tar file. Eg: system("tar -cf /tmp/example.tar /mnt/john/1.xml"); system("tar -uf... (5 Replies)
Discussion started by: vsanjit
5 Replies

4. Shell Programming and Scripting

[Perl] Capture system call error message.

Hi, I googled a bit, but could not find the answer to my problem. But I am sure it is a common issue. I have this code: #!/bin/perl -w #-d use strict; sub remsh_test() { my $host = $_; printf "\n----\n\n"; printf "remsh to $host with system call\n"; my $result = system... (3 Replies)
Discussion started by: ejdv
3 Replies

5. Shell Programming and Scripting

how to call dot c file using system command

Hi every one, i have to dot pc files. One have main function but one dont have.I have to call dot pc file using system () cmd.File is being call have main function.Please let me know how i can call .pc file with two arguments from other dot pc file.I want some thing like sprintf(buf,... (1 Reply)
Discussion started by: goraya430
1 Replies

6. Programming

how to call dot c file using system command

Hi every one, i have to dot pc files. One have main function but one dont have.I have to call dot pc file using system () cmd.File is being call have main function.Please let me know how i can call .pc file with two arguments from other dot pc file.I want some thing like sprintf(buf, "ss_xxx.pc... (4 Replies)
Discussion started by: goraya430
4 Replies

7. Shell Programming and Scripting

Running a script in system() call and want the script's output

Hi All, I have a script(sample.sh) displaying the output of "dd" command. Now i am using this script in system() call as, system("sh sample.sh") in an application file. I want the output of system("sh sample.sh") in the application file itself. How can i get it? Many thnaks.... (9 Replies)
Discussion started by: amio
9 Replies

8. Shell Programming and Scripting

Perl - Call a sub routine in a command

Hi all I have written a simple perl script that has different options i.e. myscript -l -p etc i have it so when it runs without any switches it runs a subroutine called nvrm_norm i want to be able to do a -p option and run pall -w -f and then called the subruotine pall is... (1 Reply)
Discussion started by: ab52
1 Replies

9. Shell Programming and Scripting

How to call a bash command from within a perl script?

In a bash script, one can call a perl command in the following manner, where "myperlcommand" is a perl command. perl -e 'myperlcommand(arguments)' perl -e 'print("UUUU"x4)' Now, how can one call a bash command from within a perl script? (Suppose that mybashcommand is a bash... (1 Reply)
Discussion started by: LessNux
1 Replies

10. Shell Programming and Scripting

Shell script to call Oracle archive backup script when file system reaches threshold value

Hello All, I need immediate help in creating shell script to call archivebkup.ksh script when archive file system capacity reaches threshold value or 60% Need to identify the unique file system that reaches threshold value. ex: capacity ... (4 Replies)
Discussion started by: sasikanthdba
4 Replies
service(8)						      System Manager's Manual							service(8)

NAME
service - run a System V init script SYNOPSIS
service SCRIPT COMMAND [OPTIONS] service --status-all service --help | -h | --version DESCRIPTION
service runs a System V init script in as predictable an environment as possible, removing most environment variables and with the current working directory set to /. The SCRIPT parameter specifies a System V init script, located in /etc/init.d/SCRIPT. The supported values of COMMAND depend on the invoked script. service passes COMMAND and OPTIONS to the init script unmodified. All scripts should support at least the start and stop commands. As a special case, if COMMAND is --full-restart, the script is run twice, first with the stop command, then with the start com- mand. service --status-all runs all init scripts, in alphabetical order, with the status command. EXIT CODES
service calls the init script and returns the status returned by it. FILES
/etc/init.d The directory containing System V init scripts. ENVIRONMENT
LANG, TERM The only environment variables passed to the init scripts. SEE ALSO
/etc/init.d/skeleton, update-rc.d(8), init(8), invoke-rc.d(8). Jan 2006 service(8)
All times are GMT -4. The time now is 02:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy