Skip to content

Commit

Permalink
fix locked files when upgrading live system
Browse files Browse the repository at this point in the history
stop the services before upgrading on a live system to remove any remaining file locks preventing files from getting patched in the running instance (before any reboots).
  • Loading branch information
desertwitch committed Jul 25, 2023
1 parent b3f9ae3 commit 46bc113
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugin/nut-2.8.0.plg
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ else
ln -s /var/run/upsmon.pid /var/run/nut/upsmon.pid
fi

# if upgrading on live system, stop the services here
# to release any remaining file locks before patching
[ -x /etc/rc.d/rc.nut ] && /etc/rc.d/rc.nut stop 2>/dev/null

# upgrade plugin package
upgradepkg --install-new &plgPATH;/&plgNAME;.txz

Expand Down
4 changes: 4 additions & 0 deletions plugin/nut.plg
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ if [ "${sum1:0:32}" != "${sum2:0:32}" ]; then
rm &plgPATH;/&plgNAME;.md5
exit 1
else
# if upgrading on live system, stop the services here
# to release any remaining file locks before patching
[ -x /etc/rc.d/rc.nut ] && /etc/rc.d/rc.nut stop 2>/dev/null

# upgrade plugin package
upgradepkg --install-new &plgPATH;/&plgNAME;.txz

Expand Down

0 comments on commit 46bc113

Please sign in to comment.