Below script runs fine on all Servers in my infrastructure.
However, I recently discovered that it fails to complete execution and simply hangs on Aix servers with ksh
shell.
cat myscript.sh
export LOG="./test.log"
echo "Starting"
exec >$LOG 2>&1
echo "Completed"
Below is how i have run this script
user1@myhost# . /app/myscript.sh
Output: Starting
<hangs here>
I want this script to run on on different types on OS like AiX, Solaris and Linux.
Note: This script is placed and executed from a remote server that we use for automation. The script hangs when executed remotely using ssh as well as when executed locally as shown above.
Can you propose a generic solution please?
test.log
? The script works as expected on Ubuntu Linux withbash
andksh
, and there is no obvious reason why it shouldn't work on AIX. Can you reproduce the problem with exactly the script shown in your question or is your real script different? If different, show the real script or create a minimal reproducible example . Please edit your question to add this information, don't use comments to answer.exec >$LOG 2>&1
intosomeactualprogram >$LOG 2>&1
export LOG="./test.log"; echo "Starting"; id >$LOG 2>&1; echo "Completed"