我有一个很长的 bash 脚本,做了很多事情来达到这一点......
(在案例陈述的末尾)...
{
/usr/bin/expect << EOF
set timeout 120
spawn ssh -o StrictHostKeyChecking=no root@$AMHOST1$DOMAIN "/opt/cert_hell.sh"\
expect assword:
send "$PASSWD\r"
expect #
EOF
}
;;
esac
case $ADMCFG in
($AMHOST2)
echo "############ Now we move on with our installation... ##############"
echo ""
# installation
mkdir -p /path/to/install/directory
cd /path/to/install/directory
unzip /path/to/software/source.zip`
在这一点上,它只是死了,没有输出到标准输出。我使用 strace -f 运行,以下是相关结果:
[pid 3770] +++ exited with 0 +++
<... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 3770
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f4a5d957d40}, {0x4438a0, [], SA_RESTORER, 0x7f4a5d957d40}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3770, si_status=0, si_utime=6, si_stime=8} ---
wait4(-1, 0x7fff3323ddd8, WNOHANG, NULL) = -1 ECHILD (No child processes)
rt_sigreturn() = 0
read(255, "exit 0\n\n# Here we begin configur"..., 4316) = 374
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
exit_group(0) = ?
+++ exited with 0 +++
我不确定这个字符串 ' read(255, "exit 0... ' 是否是罪魁祸首,我也无法确定它为什么突然退出。它确实继续前进并在它死之前短暂尝试执行解压缩操作。如果任何人都有任何想法,他们将不胜感激。