i have script uses exec
command redirect stdout
, stderr
file. script works fine under solaris 9. testing on solaris 10 on vmware , fails @ exec
command.
prog=`basename $0` log="${loclog}/${prog}$$" if test -z "$lddebug" exec > ${log} 2>&1 chmod 644 "${log}" else set -x fi
in above, script ends right @ line without error message.
i added quotes around variable exec > "${log}" 2>&1
. let script run end, did not create log file.
i tried file path:
exec > /tmp/blahblah1 2>&1
... , worked. created file , wrote it. doesn't solve problem because log filename has generated in script.
i lost solution here , know simple, can't think of else without having make major change script.
====== output of sh -x
ld-test@lunar-tst[60] sh -x /home/hameed/test/local/bin/qikload + basename /home/hameed/test/local/bin/qikload prog=qikload datefmt=+%h:%m:%s dayfmt=+%y%m%d log=/home/hameed/test/local/etc/log/0508/qikload2199 + test -z + exec
=======
then removed 2>&1
, ran sh -x
, went passed line.
+ basename /home/hameed/test/local/bin/qikload prog=qikload datefmt=+%h:%m:%s dayfmt=+%y%m%d log=/home/hameed/test/local/etc/log/0508/qikload27213 + test -z + exec + chmod 644 /home/hameed/test/local/etc/log/0508/qikload27213 + date +%h:%m:%s now=10:44:23 + echo log: 10:44:23 commencing loads
one plausible cause of failure $loclog
unset on solaris 10 under vmware (but set on solaris 9), script trying (but failing) write in root directory.
you can validate checking $loclog
set (for example, echo loclog="$loclog"
without redirection).
Comments
Post a Comment