Sponsored Content
Top Forums Shell Programming and Scripting Shell script replied multiple process for file has successfully created Post 302963301 by yogendra.barode on Monday 28th of December 2015 03:55:15 AM
Old 12-28-2015
Shell script replied multiple process for file has successfully created

Hi All,

I have written the following code
Code:
do
         FILE_NO=$(echo $LINE|awk -F"|" '{print $1}'|tr "'" '+'|sed 's/\(.*\)\(++\)\(.*\)\(++\)/\3/')
         INST_NO=$(echo $LINE|awk -F"|" '{print $2}'|tr "'" '+'|sed 's/\(.*\)\(++\)\(.*\)\(++\)/\3/')

         if [[ -e ${TMP_LOC}/${FILE_NO}_${INST_NO}.lck ]]
         then
             LOG_PRINT `basename $0` "Duplicate file lck: ${TMP_LOC}/${FILE_NO}_${INST_NO}.lck"
             continue
         else
            touch ${TMP_LOC}/${FILE_NO}_${INST_NO}.lck
            if [[ $? -ne 0 ]]
            then
              LOG_PRINT `basename $0` "Unable to create lck file : ${TMP_LOC}/${FILE_NO}_${INST_NO}.lck"
              continue
            fi
            LOG_PRINT `basename $0` "Successfully lck file : ${TMP_LOC}/${FILE_NO}_${INST_NO}.lck created"
         fi

         LOG_PRINT `basename $0` "Processing OUTPUT PARAM : $LINE"
         PARAM_FLAG=1
         i=$( expr $i + 1 )
         break
  done

But When I run 30 instance (same time via cron) of the script multiple output comes on the script stating that "Successfully lck file created" with same name.

Please help

Moderator's Comments:
Mod Comment Please use code tags for your data and code, thanks

Last edited by vbe; 12-28-2015 at 05:12 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can i know file using another process on lunix shell script?

hi all, I did RedHat OS. How can i know myfile using another process on lunix shell script? Have you got any suggestions? (1 Reply)
Discussion started by: Tlg13team
1 Replies

2. Shell Programming and Scripting

perl script to check if empty files are created and delete them and run a shell script

I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
Discussion started by: hussa1n
2 Replies

3. UNIX for Dummies Questions & Answers

cron job for the created shell script

Hi am newbie for unix shell.. how to create a cron job for my already created shell script.:confused: Thanks! (1 Reply)
Discussion started by: vidhyaS
1 Replies

4. UNIX for Dummies Questions & Answers

Writing a loop to process multiple input files by a shell script

I have multiple input files that I want to manipulate using a shell script. The files are called 250.1 through 250.1000 but I only want the script to manipulate 250.300 through 250.1000. Before I was using the following script to manipulate the text files: for i in 250.*; do || awk... (4 Replies)
Discussion started by: evelibertine
4 Replies

5. UNIX for Advanced & Expert Users

Which process has created a file ?

Hi All, We have a multi-threaded application. During the course of action, each process creates some files. Is there any way to know which process has created a particular file ? Ex: Suppose we have 3 process running A, B and C in the application and some files FILE1 FILE2 FILE3 and... (4 Replies)
Discussion started by: 14341
4 Replies

6. Shell Programming and Scripting

Removing lines from a file being used by another process using SHELL script

Hi All, Need a small help in writing a shell script which can delete a few lines from a file which is currently being used by another process. File gets appended using tee -a command due to which its size is getting increased. Contents like : 25/09/2012 05:18 Run ID:56579677-1 My... (3 Replies)
Discussion started by: nikhil8
3 Replies

7. Open Source

Help with writing Shell Script to automate process using multiple commands

Hello! Need help to write a Linux script that can be run from windows using command/Cygwin/any other way. I am new to scripting, actually i am trying to automate server health check like free disk space, memory along with few services status, if any services is not running then start services ,... (7 Replies)
Discussion started by: Sayed Ibrahim
7 Replies

8. Shell Programming and Scripting

Shell script to check current date file is created and with >0 kb or not for multiple directories

Hi All, I am new in scripting and working in a project where we have RSyslog servers over CentOS v7 and more than 200 network devices are sending logs to each RSyslog servers. For each network devices individual folders create on the name of the each network devices IP addresses.The main... (7 Replies)
Discussion started by: Pinaki
7 Replies

9. Shell Programming and Scripting

Shell script to report file size, pid and also kill the process

Hi All, Looking for a quick LINUX shell script which can continuously monitors the flle size, report the process which is creating a file greater than certain limit and also kill that process. Can someone please help me on this? (4 Replies)
Discussion started by: vasavimacherla
4 Replies

10. UNIX for Beginners Questions & Answers

By pass a process in a Shell Script on file size

I wish to by pass a process if the file is over a certain size? not sure this makes sense current bit of the script below #if we are bypAssing the OCR if ; then echo Bypassing HOTFOLDER OCR HOT_FOLDER_DIR=$BATCH_POST_OCR_DIR; potential change below? would this work would I need... (1 Reply)
Discussion started by: worky
1 Replies
basename(1B)					     SunOS/BSD Compatibility Package Commands					      basename(1B)

NAME
basename - display portions of pathnames SYNOPSIS
/usr/ucb/basename string [suffix] DESCRIPTION
The basename utility deletes any prefix ending in `/' and the suffix, if present in string. It directs the result to the standard output, and is normally used inside substitution marks (` `) within shell procedures. The suffix is a string with no special significance attached to any of the characters it contains. EXAMPLES
Example 1: Using the basename command. This shell procedure invoked with the argument /usr/src/bin/cat.c compiles the named file and moves the output to cat in the current direc- tory: example% cc $1 example% mv a.out `basename $1 .c` ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
sh(1), attributes(5) SunOS 5.10 28 Mar 1995 basename(1B)
All times are GMT -4. The time now is 12:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy