[prev in list] [next in list] [prev in thread] [next in thread] 

List:       aix-l
Subject:    Re: shell script advice requested
From:       Bruce Harvey <BruceH () ROUTESCAPE ! COM>
Date:       2002-05-29 14:33:55
[Download RAW message or body]

Bourne shell under AIX (I'll use square brackets to indicate names, as angle
brackets are meaningful):

[app] >$LOGIN.$SOMEVARIABLE.check.log <<ENDOFINPUT
[username]
[DBInstance]
[password]
[app subcommand]
[exit]
ENDOFINPUT
exit 0


For example, assuming the above names are variables, you could use them in a
loop and substitute values for each iteration:

# 'myapp' is the name of the application
# assume LOGIN == 'bruce'
# the '>' character redirects output to a file
# and '>>' would append data to that file
# the '<<' redirects INPUT to your script as "HERE TEXT"
# If you "escape" the final label (ENDOFINPUT) by placing a
# backslash '\' in front of it (\ENDOFINPUT), then any
# variables you include in the HERE TEXT will NOT be
# interpreted (i.e., the dollar sign $ will be taken as a
# literal ... good for building other scripts that use
# HERE TEXT)
# By the way, instead of ENDOFINPUT, you could use EOF or
# EOTF or SAMANTHA or whatever ... it's just a label

# LOGIN is defined when you ... uh ... log in
MyDB='testDB'
MyPassword='2b|!2b'
MyAppTestCmd='runCheck'

myapp >$LOGIN.check.log <<ENDOFINPUT
$LOGIN
$MyDB
$MyPassword
$MyAppTestCmd
exit
ENDOFINPUT
exit 0

# The above would be interpreted by the shell as ...

myapp >bruce.check.log <<ENDOFINPUT
bruce
testDB
2b|!2b
runCheck
exit
ENDOFINPUT
exit 0



> $define sys$output user01:[user.<env>]check.log
> $set noon
> $<app>
> <username>
> <DBInstance>
> <password>
> <app subcommand>
> exit
> $deassign sys$output
> $exit
>


> -----Original Message-----
> From: Barnhart, Troy [mailto:TBarnhart@RCRH.ORG]
> Sent: Wednesday, May 29, 2002 10:12 AM
> To: aix-l@Princeton.EDU
> Subject: [aix-l] shell script advice requested
>
>
> I have an application that is to be run interactively.
> I'd like to write a script that sets up an output file,
> executes the application, (which requires a login to an
> oracle database) then runs a subcommand of that application
> and all these results are sent to the output file.
>
> I'm trying to build an email alert.  That if a service from
> an application is not running it will generate an alert.
>
> I am on AIX 4.3.3, although I have a VMS script for the same
> application.  Is there a similar method to the VMS script on
> AIX.
>
> -----------------------------------------------------------
> VMS version of script -
>
> $define sys$output user01:[user.<env>]check.log
> $set noon
> $<app>
> <username>
> <DBInstance>
> <password>
> <app subcommand>
> exit
> $deassign sys$output
> $exit
> -----------------------------------------------------------
> AIX similar version?
>
> 1.  Setup the log file.
> 2.  run command.
> 3.  enter username, database instance, password
> 4.  run sub-command.
> 5.  redirect output to log file.
> 6.  exit from command.
> 7.  exit script.
> -----------------------------------------------------------
>
>
> tia,
> troy
>
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic