Sponsored Content
Top Forums Shell Programming and Scripting Few doubts on Linux scripting Post 302440198 by umar.shaikh on Monday 26th of July 2010 12:11:41 PM
Old 07-26-2010
Those are some long questions Smilie
I'll attempt the first. It sounds fairly simple.
You need to get the current time stamp in your initial script and pass that as an argument to your 3 scripts.
Code:
TIMESTAMP=`date +%H%M%S`
#Or whichever format you prefer it in
./$POS_SCRIPT/dw_postodw_pharmacysplit.ksh $TIMESTAMP
./$POS_SCRIPT/dw_postodw_controlfile.ksh $TIMESTAMP
./$POS_SCRIPT/dw_postodw_cpfiles.ksh $TIMESTAMP

In each of these 3 scripts, you would write:
Code:
TIMESTAMP=$1

That should give you the common time stamp throughout all 3 scripts.

Regarding your second sub question, error handling should be done within the files itself. If you encounter an error, you could choose to exit with a specific error code (You can have an error code to error text mapping somewhere).

Something like:
Code:
exit 1

You can handle the return status best in your initial script itself.

Code:
TIMESTAMP=`date +%H%M%S`
#Or whichever format you prefer it in
RETURN_CODE=`$POS_SCRIPT/dw_postodw_pharmacysplit.ksh $TIMESTAMP`
if [ $RETURN_CODE -ne 0 ]
then
#ECHO ERROR TO LOG FILE
fi RETURN_CODE=`$POS_SCRIPT/dw_postodw_controlfile.ksh $TIMESTAMP` if [ $RETURN_CODE -ne 0 ] then
#ECHO ERROR TO LOG FILE
fi RETURN_CODE=`$POS_SCRIPT/dw_postodw_cpfiles.ksh $TIMESTAMP` if [ $RETURN_CODE -ne 0 ] then
#ECHO ERROR TO LOG FILE
fi

 

9 More Discussions You Might Find Interesting

1. Programming

Doubts About C Compiler In Unix/linux

As all of you know whenever a program "say a.c" is complied in linux using the gcc or the cc compiler..it shows the list of errors ( if the program contains any).. i want to modify the compier script so as to list the no of errors only and not the description about the error..like" parse error " ... (1 Reply)
Discussion started by: vrs
1 Replies

2. Red Hat

qmail configuration in redhat linux - doubts

hi, How to Install & configure the qmail in redhat linux? and also how to get the free qmail package? I know the sendmail configuration in redhat linux. What is the features of qmail compared with sendmail? Regards, Jones (3 Replies)
Discussion started by: jones_linux
3 Replies

3. Shell Programming and Scripting

Unix Scripting on Linux 9.

I am NEW to Unix. I studied a few Unix Shell Commands 8 years ago in IBM AIX machines. I want to learn/brush up Unix shell commands, therefore I just installed Red Hat Linux 9 in a P3 machine. But I do not know where to start Unix Scripting in that Linux. I chose Desktop / Personnel while ... (2 Replies)
Discussion started by: risuresh
2 Replies

4. Programming

Doubts about timers in linux kernel

Hi , I am trying to learn timers in linux kernel. I am trying to write a program where I can configure a timer to tick in every 5 seconds and a function should thus exicute in every five seconds. I tried one program with the help of linux/timer.h headerfile but I couldnt get the... (4 Replies)
Discussion started by: iamjayanth
4 Replies

5. Shell Programming and Scripting

shell scripting doubts

Hello All, I am working in a reputed software firm,currently working on testing platform (manual and automation).But I am very much intersted in unix and shell scripting,I feel that I am good at beginner level of shell scripting,still I want to practise shell scripting to become excel in it.I... (1 Reply)
Discussion started by: maheshglm
1 Replies

6. Solaris

Unix scripting doubts

i hav a file like this -rwxr-xr-x 1 root controlm 4141 Nov 13 2006 /opt/scripts/prod/fvaauditlos.ksh -rwxr-xr-x 1 root controlm 3958 Nov 13 2006 /opt/scripts/prod/fvaexpchbk1.ksh -rwxr-xr-x 1 root controlm 6471 Nov 13 2006 /opt/scripts/prod/fvaexpchbk2.ksh... (24 Replies)
Discussion started by: p_satyambabu
24 Replies

7. UNIX for Dummies Questions & Answers

Linux kernel modules makefiles doubts

This query is regarding the makefiles of linux kernel modules. I saw at some sites on net it is suggesting to include the following path: KERNEL_SOURCE := /usr/src/linux... while at some places it is askibg to include /lib/modules path: KERNEL_SOURCE := /lib/modules/2.6.27-7-generic/build... (0 Replies)
Discussion started by: rupeshkp728
0 Replies

8. Shell Programming and Scripting

Practice Linux Scripting

hey everyone, does anyone here have any good sites, or book recommendations that give you practice scripts to write? It's hard for me to think of scripts that I should write for practice. I've written a small backup script, but I'd rather have a source that gives me ideas, and practice for... (1 Reply)
Discussion started by: Lost in Cyberia
1 Replies

9. Shell Programming and Scripting

Need help on bash scripting in Linux

Could anyone help me with the below scripting task. my requirement is as below 1. I have two directories /var/tmp/dir1 & /var/tmp/dir2 once i run the script test.sh it should ask as below. Please choose the below path 1 (or) 2 1. /var/tmp/dir1 2. /var/tmp/dir2 else. exit 2. once i... (4 Replies)
Discussion started by: praveenkumar.v
4 Replies
create directory(1m)													      create directory(1m)

NAME
create directory - Creates a directory SYNOPSIS
cdscp create directory directory-name [clearinghouse clearinghouse-name] ARGUMENTS
The full name of the directory The name of the clearinghouse in which you create the directory. DESCRIPTION
The create directory command creates a directory with the name that you specify. If you do not specify a clearinghouse, CDS creates the master replica of the directory in the same clearinghouse as the new directory's parent directory. Privilege Required You must have the following permissions in order to create a directory: read and insert permission to the parent directory; write permis- sion to the clearinghouse in which the master replica of the new directory is to be stored. In addition, the server principal must have read and insert permission to the parent directory. NOTES
To ensure that all replicas are consistent, perform an immediate skulk of the parent directory after issuing this command. This command is replaced at Revision 1.1 by the dcecp command and may not be provided in future releases of DCE. EXAMPLE
The following command creates a directory named /.:/sales. cdscp> create directory /.:/sales RELATED INFORMATION
Commands: delete directory(1m), list directory(1m), set directory(1m), set directory to skulk(1m), show directory(1m) create directory(1m)
All times are GMT -4. The time now is 02:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy