Kbase P96026: How to investigate the actions of a script started from a AppServer session?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2008 |
|
Status: Unverified
GOAL:
How to investigate the actions of a script started from a AppServer session?
FACT(s) (Environment):
UNIX
FIX:
There is no general way, but the example below is was applied to a FTP
transfer script that was called by OS-COMMAND from the 4GL code running
on the AppServer.
#!/bin/bash
# Debug shell script
# Only owner can read files that the
# script creates
umask 066
# Log time
echo >> /tmp/shell.log
echo >> /tmp/shell.log
date >> /tmp/shell.log
# Log script parameters
echo "Number of parameters:" $# >> /tmp/shell.log
echo "Parameters:" $* >> /tmp/shell.log
# Arguments:
site=$1
subdir=$2
# Generating some data to send
mkdir -p ${subdir}
echo "test" >> ${subdir}/test.txt
# Activating this line will make ftp look for
# .netrc in /tmp.
#HOME=/tmp
# Dump environment in /tmp/shell.log
echo >> /tmp/shell.log
echo "Shell environment:" >> /tmp/shell.log
set >> /tmp/shell.log
# FTP content to ${site}, login / password in
# $HOME/.netrc file. Loging ftp output to /tmp/shell.log
# Also track the system calls of ftp to a separate log.
echo >> /tmp/shell.log
echo "Status of FTP transfer:" >> /tmp/shell.log
strace -o /tmp/shell_ftp_strace_`date +%Y%m%d_%H%M-%S%z`.log ftp ${site}<< eof >> /tmp/shell.log 2>&1
bin
prompt
mkdir /tmp/${subdir}
cd /tmp/${subdir}
lcd ${subdir}
put test.txt
bye
eof