fix: add log for actpkg shell script

This commit is contained in:
2024-02-01 11:34:46 +08:00
parent 697462ad1b
commit f59b67dbc5

View File

@@ -5,6 +5,7 @@ neType="$2"
duration=180
expectBin=/usr/bin/expect
omcBin=/usr/local/omc/bin
logFile=/tmp/actpkg`date +%Y%m%d`.log
extension=$(basename "${1}" | awk -F . '{print $NF}')
if [ ! -f ${expectBin} ]; then
@@ -17,7 +18,7 @@ case "${extension}" in
if [ ${neType} == "OMC" ]; then
systemctl stop restagent.service
fi
expect <<EOF
expect <<EOF > ${logFile}
spawn dpkg -i --force-all "$filename"
set timeout ${duration}
expect {
@@ -25,14 +26,14 @@ case "${extension}" in
}
EOF
if [ ${neType} == "OMC" ]; then
${omcBin}/setomc.sh -m upgrade
${omcBin}/setomc.sh -m upgrade >> ${logFile}
fi
;;
rpm)
if [ ${neType} == "OMC" ]; then
systemctl stop restagent.service
fi
expect <<EOF
expect <<EOF > ${logFile}
spawn rpm -Uvh "$filename"
set timeout ${duration}
expect {
@@ -40,7 +41,7 @@ EOF
}
EOF
if [ ${neType} == "OMC" ]; then
${omcBin}/setomc.sh -m upgrade
${omcBin}/setomc.sh -m upgrade >> ${logFile}
fi
;;
*)