fix: log for rollback package
This commit is contained in:
@@ -5,6 +5,7 @@ neType="$2"
|
|||||||
duration=180
|
duration=180
|
||||||
expectBin=/usr/bin/expect
|
expectBin=/usr/bin/expect
|
||||||
omcBin=/usr/local/omc/bin
|
omcBin=/usr/local/omc/bin
|
||||||
|
logFile=/tmp/actpkg`date +%Y%m%d`.log
|
||||||
extension=$(basename "${1}" | awk -F . '{print $NF}')
|
extension=$(basename "${1}" | awk -F . '{print $NF}')
|
||||||
|
|
||||||
if [ ! -f ${expectBin} ]; then
|
if [ ! -f ${expectBin} ]; then
|
||||||
@@ -17,7 +18,7 @@ case "${extension}" in
|
|||||||
if [ ${neType} == "OMC" ]; then
|
if [ ${neType} == "OMC" ]; then
|
||||||
systemctl stop restagent.service
|
systemctl stop restagent.service
|
||||||
fi
|
fi
|
||||||
expect <<EOF
|
expect <<EOF > ${logFile}
|
||||||
spawn dpkg -i --force-all "$filename"
|
spawn dpkg -i --force-all "$filename"
|
||||||
set timeout ${duration}
|
set timeout ${duration}
|
||||||
expect {
|
expect {
|
||||||
@@ -25,22 +26,22 @@ case "${extension}" in
|
|||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
if [ ${neType} == "OMC" ]; then
|
if [ ${neType} == "OMC" ]; then
|
||||||
${omcBin}/setomc.sh -m upgrade
|
${omcBin}/setomc.sh -m upgrade >> ${logFile}
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
rpm)
|
rpm)
|
||||||
if [ ${neType} == "OMC" ]; then
|
if [ ${neType} == "OMC" ]; then
|
||||||
systemctl stop restagent.service
|
systemctl stop restagent.service
|
||||||
fi
|
fi
|
||||||
expect <<EOF
|
expect <<EOF > ${logFile}
|
||||||
spawn rpm -Uvh --oldpackage "$filename"
|
spawn rpm -Uvh "$filename"
|
||||||
set timeout ${duration}
|
set timeout ${duration}
|
||||||
expect {
|
expect {
|
||||||
"y/n" { send "y\n"; exp_continue }
|
"y/n" { send "y\n"; exp_continue }
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
if [ ${neType} == "OMC" ]; then
|
if [ ${neType} == "OMC" ]; then
|
||||||
${omcBin}/setomc.sh -m upgrade
|
${omcBin}/setomc.sh -m upgrade >> ${logFile}
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
Reference in New Issue
Block a user