Last Update: September 9, 1998
Product: Client Access for UNIX
Operating System: All
Article ID: SQV00CA006
Client Access for UNIX OS comes with the command line utility cash. You can choose to script this application to execute repetitive tasks. This document will show three ways to automate cash.
This document describes three methods for creating a shell script that uses the cash utility.
cash < input_file
The output can also be printed on the screen, as well as to an output file, by using the following command:
cash < input_file 2>&1 | tee ${OUTFILE}
The contents of the input file may look like this:
get /qsys.lib/tim.lib/myfile.file /home/tim/myfile
put myfile /qsys.lib/tim.lib/yourfile.file
mkdir /temp
echo Executing cash command $*
$CA400/bin/cash << EOF
$*
EOF
echo status is $?
Then, you can call this script on the command line with a single cash command, such as:
run_cash get /qsys.lib/tim.lib/myfile.file myfile
echo 'command' | cash
e.g.
echo 'get /qsys.lib/tim.lib/myfile.file myfile' | cash
This would be the simplest and most powerful way to script cash.
You can invoke the script from the AS/400 computer by using the RUNRMTCMD command:
RUNRMTCMD CMD('/home/mydir/myscript') RMTLOCNAME(MYUNIX *IP) RMTUSER('myuser') RMTPWD('mypassword')
Be sure to enclose the user and password in single quotes to prevent the AS/400 CL interpreter from folding them to upper case. Output from the script will appear in the AS/400 printer queue (e.g. PRT01).
The inetd daemon on the UNIX system needs to be configured to allow incoming rexec requests.
On most UNIX systems, this is done by editing /etc/inetd.conf e.g.:
exec stream tcp nowait root /usr/sbin/rexecd rexecd
and sending a SIGHUP signal to the running inetd process with
kill -HUP processID
On Linux systems, enable rexec by editing /etc/xinetd.d/rexec (change disable from yes to no) and invoking
/etc/init.d/xinetd reload
The information in technical documents comes without any warranty. The author(s) or distributor(s) will not accept responsibility for any damage incurred directly or indirectly through use of the information contained in these documents. The information in technical documents may be gathered from various sources, including IBM, Microsoft, and other organizations.