Hi all,

I know this might be a little off the topic but i know this group can help me with my questions.

I am trying to execute a ssh command from a shell script. When execute, this script build.sh fine if i do: ./build.sh

However, if i do: ./build.sh > logfile 2>&1 ,the ssh command will hang from time to time and i cannot figure out the reason. The same problem with using "exec > $LOG_FILE 2>&1" within the script to capture logs.

Please help before i hurt my head scratching :)

I attached a couple of functions that I used SSH command within the script and hope someone can help to identify the issue...

Thank you.

Barry

# ---------------- FUNCTIONS -----------------
#

stop_weblogic () {

echo
echo "INFO: START: stop_weblogic"
echo
echo
echo "INFO: Stopping the weblogic server in host $HOST..."
(ssh -q $HOST "cd $MODULE_BIN_DIR; ant stop_weblogic") &

echo
echo "INFO: COMPLETED: stop_weblogic"

sleep 10

}

build () {

echo
echo "INFO: START: build"

echo
echo "INFO: Creating build number."
echo
echo
(ssh -q $HOST "cd $MODULE_BIN_DIR; ant build_number")

echo
echo "INFO: DO ALL!."
echo
echo
(ssh -q $HOST "cd $MODULE_BIN_DIR; ant do_all")

echo
echo "INFO: Doing EJB."
echo
echo
(ssh -q $HOST "cd $MODULE_BIN_DIR; ant ejb_jars_uptodate")

echo
echo "INFO: COMPLETED: build"

}

# ----------------- MAIN ---------------------
#

exec > $LOG_FILE 2>&1

echo
echo "INFO: START: `date`"

notify_start;
stop_weblogic;
#get_latest;
pre_build;
#build;
post_build;
start_weblogic;
check_if_wl_server_started;
checkbuild.sh $LOG_FILE
notify_complete;

echo
echo "INFO: END: `date`"

--------------------------------------------
My mailbox is spam-free with ChoiceMail, the leader in personal and corporate 
anti-spam solutions. Download your free copy of ChoiceMail from 
www.choicemailfree.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to