dalgibbard / citrix_xenserver_patcher

Auto / Manual Patching tool for Citrix XenServer Boxes
Do What The F*ck You Want To Public License
142 stars 45 forks source link

Remove downloaded patch files after successful patching. #22

Closed dalgibbard closed 9 years ago

dalgibbard commented 9 years ago
dalgibbard commented 9 years ago

v1.4 Planned Change:

\ Allow flag to NOT delete the patch files.

dalgibbard commented 9 years ago

\ Add new flag to documenation as appropriate.

dsiminiuk commented 9 years ago

This is almost working. After the patches are applied all files except the source files are removed.

-rw-r--r-- 1 root root 18982874 Sep 20 04:49 XS62ESP1011-src-pkgs.tar.bz2
-rw-r--r-- 1 root root 18982100 Sep 26 05:31 XS62ESP1013-src-pkgs.tar.bz2
-rw-r--r-- 1 root root  4821139 Oct  3 09:03 XS62ESP1014-src-pkgs.tar.bz2
sjkeerthi commented 9 years ago

This is about the deleting the the downloaded zip file. I am considering about once the patch installed you can see the /var/patch will occupies some space of disk.

Should consider to have options as --cleanpatch this should work as xe patch-clean command in backed.

dsiminiuk commented 9 years ago

I solved this another way.

create a file in /etc/cron.daily call it clean-var-patch it contains

#!/bin/bash
/usr/bin/find /var/patch -maxdepth 1 -type f -name "*-*-*-*" -mtime + 1 -exec rm {} \; 2>/dev/null

And let the cleanup happen by itself.

dalgibbard commented 9 years ago

Tested this in the new code; works well. Both src packages and /var/patch files are cleaned after each patch is successfully deployed. -C flag has been made available to disable the cleaning actions.

The only caveat is that the patch-clean command doesn't apply to pool slaves in a pool scenario; but that's a small price to pay really.

Will close this once i've committed my changes.