Visit Our UNIX and Linux User Community


Pointers on writing a unix script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Pointers on writing a unix script
# 8  
Old 10-08-2009
I am trying to execute the below as a pat of shell script however the file is always bein created with no results from this part
Code:
<<
cat >> $CNTRL_M_FILE <<EOF
<DEFJOB>
        <JOB APR="1" AUG="1" DEC="1" FEB="1" JAN="1" JUL="1" JUN="1" MAR="1" MAY="1" NOV="1" OCT="1" SEP="1" GROUP="RATES_FILEWATCH" OWNER="rdsprod" RETRO="0" SHIFT="IGNOREJOB" SYSDB="0" AUTHOR="drutter" CYCLIC="0" NODEID="rds" TIMETO="&gt;" CMDLINE="/app/ControlMagent6.2/uat/DLNSHCTM03/exe/ctmfw /app/data/rds/PLNMARS4/todo/SYCLEX_%%$ODATE._RISK.CSV CREATE 0 30 200 3 600 Y " CONFIRM="0" JOBNAME="RDS||`echo "$FEILD1"`||1" MAXDAYS="0" MAXRUNS="0" MAXWAIT="5" MEMLIB="" MEMNAME="" AUTOARCH="0" CRITICAL="0" INTERVAL="00030M" MAXRERUN="0" SHIFTNUM="+00" TASKTYPE="Command" TIMEFROM="2150" WEEKDAYS="1,2,3,4,5 | " DATACENTER="DLNSHCTM03/" IND_CYCLIC="START" TABLE_NAME="RDS_CREDITPRODUCTS" ADJUST_COND="N" APPLICATION="RDS" DAYS_AND_OR="AND" DESCRIPTION=`echo "$FEILD2"` MULTY_AGENT="N" CHANGE_USERID="drutter" CREATION_DATE=`echo "$(date +%Y%m%d)"` CREATION_TIME=`echo "$(date +%l%M%S)"` CREATION_USER="drutter">
                <ON CODE="*" STMT="*">
                        <DOSYSOUT PAR="/app/log/rds/%%JOBNAME..%%DATE.%%TIME" OPTION="Copy"/>
                </ON>
                <OUTCOND NAME="RDS-RDS1084001D-OK" ODATE="ODAT" SIGN="ADD"/>
                <SHOUT WHEN="EXECTIME" TIME="" DEST="RDS_SUPPORT" URGENCY="V" MESSAGE="%%JOBNAME OVERRUNNING REVIEW DOC"/>
        </JOB>
EOF
>>

Complete script if needed

Code:
#!/bin/sh
CNTRL_M_FILE=/app/fao/rds/bin/ControlM_Main.xml
echo "<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE DEFJOB SYSTEM "defjob.dtd">" > $CNTRL_M_FILE
FEILD1=`awk -F"|" '{print $1}' Results.txt`
FEILD2=`awk -F"|" '{print $2}' Results.txt`
FEILD3=`awk -F"|" '{print $3}' Results.txt`
FEILD4=`awk -F"|" '{print $4}' Results.txt`
echo "$FEILD1"
echo "$FEILD4"
cat >> $CNTRL_M_FILE <<EOF
<DEFJOB>
        <JOB APR="1" AUG="1" DEC="1" FEB="1" JAN="1" JUL="1" JUN="1" MAR="1" MAY="1" NOV="1" OCT="1" SEP="1" GROUP="RATES_FILEWATCH" OWNER="rdsprod" RETRO="0" SHIFT="IGNOREJOB" SYSDB="0" AUTHOR="drutter" CYCLIC="0" NODEID="rds" TIMETO="&gt;" CMDLINE="/app/ControlMagent6.2/uat/DLNSHCTM03/exe/ctmfw /app/data/rds/PLNMARS4/todo/SYCLEX_%%$ODATE._RISK.CSV CREATE 0 30 200 3 600 Y " CONFIRM="0" JOBNAME="RDS||`echo "$FEILD1"`||1" MAXDAYS="0" MAXRUNS="0" MAXWAIT="5" MEMLIB="" MEMNAME="" AUTOARCH="0" CRITICAL="0" INTERVAL="00030M" MAXRERUN="0" SHIFTNUM="+00" TASKTYPE="Command" TIMEFROM="2150" WEEKDAYS="1,2,3,4,5 | " DATACENTER="DLNSHCTM03/" IND_CYCLIC="START" TABLE_NAME="RDS_CREDITPRODUCTS" ADJUST_COND="N" APPLICATION="RDS" DAYS_AND_OR="AND" DESCRIPTION=`echo "$FEILD2"` MULTY_AGENT="N" CHANGE_USERID="drutter" CREATION_DATE=`echo "$(date +%Y%m%d)"` CREATION_TIME=`echo "$(date +%l%M%S)"` CREATION_USER="drutter">
                <ON CODE="*" STMT="*">
                        <DOSYSOUT PAR="/app/log/rds/%%JOBNAME..%%DATE.%%TIME" OPTION="Copy"/>
                </ON>
                <OUTCOND NAME="RDS-RDS1084001D-OK" ODATE="ODAT" SIGN="ADD"/>
                <SHOUT WHEN="EXECTIME" TIME="" DEST="RDS_SUPPORT" URGENCY="V" MESSAGE="%%JOBNAME OVERRUNNING REVIEW DOC"/>
        </JOB>
EOF


Last edited by vbe; 10-08-2009 at 06:17 AM.. Reason: added code tags, rm URL...

Previous Thread | Next Thread
Test Your Knowledge in Computers #387
Difficulty: Medium
The Unix apropos utility locates commands using a neural network.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

i writing a unix script but i want to out put a file and append on it.

i have an existing script that is used to send an e-mail containing the alrams that appear on the server. But i need to create a daily log file containing all the alarms that was send that day. i tired to add at the and of the script a command, echo command but for some reason the file was... (1 Reply)
Discussion started by: ashraf_victory
1 Replies

2. UNIX for Dummies Questions & Answers

Teaching myself Unix - Need websites and other pointers

Hi, I am new to Unix. I've started with a book "Unix for Dummies". Please help, any websites with extensive amount of practice exercises are needed. I need to practice! Also I would appreciate any books that are good for beginners. Thanks to all! (1 Reply)
Discussion started by: zamcruiser
1 Replies

3. UNIX for Dummies Questions & Answers

New guy needing help writing a Unix Script

I'm very new with Unix and and am needing assistance in writing a Unix script that will uncompress a dated file then rename it. The script will also need to remove several old files that have a similar naming. The directory that the files reside in is call achdirdep the file that I need uncompress... (1 Reply)
Discussion started by: mlx707
1 Replies

4. Shell Programming and Scripting

Writing Unix script to accept arguments

Hi, This may be answered elsewhere but I wasn't entirely sure of the wording I should use to search so here we go with an attempt: I wish to make a script that will allow commands to be passed to it such as: <command> -oOPTIONS -aANOTHER -pRINT etc However I don't really know the... (3 Replies)
Discussion started by: stuaz
3 Replies

5. Shell Programming and Scripting

Need help in writing script for finding files in the unix machine?

I would like to find whether a file exists in the UNIX machine. That i can check using if ;then echo "exists" echo " `cat $file` " else echo "invalid file" fi. and i can find out using : find / -name "filename" . But it i have wanted to search in all directories. How to get... (3 Replies)
Discussion started by: rparsa001
3 Replies

6. Shell Programming and Scripting

need help writing this unix script

Create an executable script file called "newname" that will perform the followings: 1. Rename a file upon the user's request. If the file exists, prompt the user for confirmation before renaming the file. The screen should prompt the user for a. "Name of file you want to rename." Use the "\c"... (7 Replies)
Discussion started by: wiggles
7 Replies

7. Shell Programming and Scripting

help writing this unix script

I am working on writing scripts. Here is a script I need help with. I have also wrote what I think it is. I would really appreciate any help that I can get. Create an executable script file called "newname" that will perform the followings: 1. Rename a file upon the user's request. If the... (2 Replies)
Discussion started by: wiggles
2 Replies

8. UNIX for Dummies Questions & Answers

Perl Unix Script Writing

Hi Folks, I posted a few days ago, thanks for the responses. My original question was for renaming files of sort 3p2325294.dgn in a directory containing multiple files. I need to drop the first 2 characters and the last in a unix script using Perl. How does it differ from using the Unix... (1 Reply)
Discussion started by: Dinkster
1 Replies

9. Programming

relative pointers on Unix

Hi all: We're porting lot of C code from Windows to Unix. In Windows we're using relative pointers (with the _based keyword) to access some structures placed on shared memory. We would need something like the Microsoft's _based keyword for unix. Does something similar exist in Unix? If not, is... (3 Replies)
Discussion started by: rahul_verma
3 Replies

10. Shell Programming and Scripting

Need help in writing a unix script

OS: Solaris Shell : KSH Please help me in writing a script that captures a error message from a log file ( which updates continiously ) and send an email alert as soon as the systems throws a error message into that log. i.e With out monitoring the log Thanks in advance.. (1 Reply)
Discussion started by: pray44u
1 Replies

Featured Tech Videos