Sponsored Content
Top Forums Shell Programming and Scripting KSH, FTP running a set number at a time? Post 302224616 by awk on Wednesday 13th of August 2008 02:48:16 PM
Old 08-13-2008
Here is a code I did that regulates the flow of programs running to 4

You should be able to modify as you need

Code:
while read LINE                          # go through the output file from the view one line at a time
do

     export SRC_FILE_ID=$(echo $LINE | cut -f 1 -d \|)
     export SRC_FILE_TYPE=$(echo $LINE | cut -f 2 -d \|)
     export INBOUND_DIR=$(echo $LINE | cut -f 3 -d \|)
     export FILENAME=$(echo $LINE | cut -f 4 -d \|)
     export XTB_TB_NAME=$(echo $LINE | cut -f 5 -d \|)
     export REGEXP=$(echo $LINE | cut -f 6 -d \|)



     echo_f ""
     echo_f 'SRC_FILE_ID:      ' $SRC_FILE_ID
     echo_f 'SRC_FILE_TYPE:    ' $SRC_FILE_TYPE
     echo_f 'INBOUND_DIR:      ' $INBOUND_DIR
     echo_f 'FILENAME:         ' $FILENAME
     echo_f 'XTB_TB_NAME:      ' $XTB_TB_NAME
     echo_f 'REGEXP:           ' "$REGEXP"


    if [[ ! -r $INBOUND_DIR/$FILENAME ]]  # if the file does not exist, go to next one
    then
       echo_f $INBOUND_DIR/$FILENAME not found at $(date)
       echo_f skipping this processing
       continue;
    fi

   case $(echo $SRC_FILE_TYPE | cut -c -1) in
         M)    export PACKAGE="PKG_DW_CLM_LOAD";;
         P)    export PACKAGE="PKG_DW_CLMRX_LOAD";;
   esac


    # getting here, we want to submit the job to run, up to the limit of 4 jobs running at one time
    # See if there are 4 jobs running right now
      while [[ $( jobs | wc -l ) -ge 4 ]]
      do
        echo_f going to sleep now at $(date)
        sleep 30
      done

      /avidyn/scripts/avd_runit_002.ksh 1>/dev/null 2>&1 &   # parameters are passed by the export statements

done < /avidyn/tmp/avd_runit_001_jobs_to_run.txt

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

problem with set -A in ksh

I am trying to load a file into an array by using the set -A command in the ksh. The file contains a comma delimited record of 19 fields and is 5196 records long. If I execute the following command, I get the record count. cut -f1-19 -d',' -s RAGEFF.lst|sed 's/,/ /g'|sed 's/\L//g'|nawk '{ if... (2 Replies)
Discussion started by: beilstwh
2 Replies

2. Shell Programming and Scripting

ksh: dbfFILe: parameter not set

Having the following message returned: FIND REDLOG FILES..... ksh: dbfFILe: parameter not set When I attempt to perform the script below....#!/bin/ksh . $HOME/.profile # Initial Script Prerequisites ORACLE_SID=MDirect ; export ORACLE_SID REDOLOGDIR=$ARCLOGDEST ; export REDOLOGDIR... (2 Replies)
Discussion started by: Cameron
2 Replies

3. Shell Programming and Scripting

set Working day in ksh

Hello guys it´s a pleasure to type with the unix community...I´m new in shell script and I need to insert into a #!/ksh a statment that will check if a file that I´ll receive from another script is arriving in the first working day of each month: let´s say that I´ll reveive the following files... (1 Reply)
Discussion started by: Rafael.Buria
1 Replies

4. Shell Programming and Scripting

Running a queued set of commands?

Is there a way I can queue something like 800 commands in a BASH (or anything else for that matter) script? I just basically don't want to have 800 commands pound my system at once. So far I have been just running the list (dynamically generated) through a loop, and executing every command in... (1 Reply)
Discussion started by: jjinno
1 Replies

5. Shell Programming and Scripting

KSH script eval(?) to set variable

first of all, thanks to all on this board, it has been a huge resource to answer most of my questions! I am stuck on something that should really be simple, and was looking for some help.. I am using KSH on solaris and working on a script to move containers from server to server. Where i am... (4 Replies)
Discussion started by: tksol
4 Replies

6. Shell Programming and Scripting

Ftp script hangs for first time,but works every second time

Hi I have an ftp script which works fine when i execute through a test scheduler(UC4), but when i run it through the prod scheduler(UC4), it hungs indefinetely, when we cancel the job and re-run it it works perfectly fine. here is the code,, any idea why this is happening ???? ... (1 Reply)
Discussion started by: selvankj
1 Replies

7. Shell Programming and Scripting

set ksh script in restricted mode

Hi, I came across a post wherein you can use "set -r"(on bash) to activate restricted mode ( wherein you cant run some commands such as cd etc). Can anyone guide if we have anything similar in ksh ? Thanks (2 Replies)
Discussion started by: Shivdatta
2 Replies

8. Shell Programming and Scripting

Unable to set PATH through ksh shell

I'm trying to set path for the current session but it is not doing so. It works perfectly on command line though. #!/usr/bin/ksh PATH=$PATH:/opt/quest/bin Is there any specific way to set path on korn? (3 Replies)
Discussion started by: pjeedu2247
3 Replies

9. Shell Programming and Scripting

Help with sort word followed by exponential number and numeric number at the same time

Input file: ID_34 2E-69 2324 ID_1 0E0 3254 ID_1 0E0 5434 ID_5 0E0 436 ID_1 1E-14 2524 ID_1 5E-52 46437 ID_3 65E-20 45467 ID_1 0E0 6578 ... Desired output file: ID_1 0E0 6578 ID_1 0E0 5434 ID_1 0E0 3254 ID_1 5E-52 46437 ID_1 1E-14 2524 ID_3 65E-20 45467 (5 Replies)
Discussion started by: cpp_beginner
5 Replies

10. Shell Programming and Scripting

ksh - variable to be set to windows path issue

Greetings Experts, I need to pass a parameter to ksh and the value is windows path eg: sh abc.txt C:\Users\chill3chee\Desktop No matter I try with \ delimiter, still could not get this exact value assigned to the shell variable which was checked with echo. Tried with using... (2 Replies)
Discussion started by: chill3chee
2 Replies
starting(7)						 Miscellaneous Information Manual					       starting(7)

NAME
starting - event signalling that a job is starting SYNOPSIS
starting JOB=JOB INSTANCE=INSTANCE [ENV]... DESCRIPTION
The starting event is generated by the Upstart init(8) daemon when a new instance of a job begins starting. The JOB environment variable contains the job name, and the INSTANCE environment variable contains the instance name which will be empty for single-instance jobs. init(8) will wait for all services started by this event to be running, all tasks started by this event to have finished and all jobs stopped by this event to be stopped before allowing the job to continue starting. This allows jobs to effectively insert themselves as dependencies of other jobs. The event is typically combined with the stopped(7) event by services. Job configuration files may use the export stanza to export environment variables from their own environment into the starting event. See init(5) for more details. EXAMPLE
A service that wishes to be running whenever another service would be running, started before and stopped after it, might use: start on starting apache stop on stopped apache A task that must be run before another task or service is started might use: start on starting postgresql SEE ALSO
started(7) stopping(7) stopped(7) init(5) Upstart 2009-07-09 starting(7)
All times are GMT -4. The time now is 05:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy