|
||||||
| Forums FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| ARCHIVES - Tips, Tricks & Tweaks Post your tips, tricks and tweaks about SuSE Linux in here. Please do not ask questions here - this is for factual information |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
OK, so you copy this script;
Code:
#!/bin/sh sqlite3 /var/cache/zypp/zypp.db vacuum rpm --rebuilddb******** # takes long for fn in****** /var/cache/zypp/zypp.db \ ****************/var/lib/rpm/Packages** \ ****************/var/lib/rpm/Filemd5s** \ ****************/var/lib/rpm/Dirnames** \ ****************/var/lib/rpm/Basenames do ********cp $fn $fn.new || exit 1 ********rm $fn ********mv $fn.new $fn done Once this is done, if you want it to run with SuSEconfig, simply move the script to /sbin/conf.d/ Now, if you leave the script as is, it will run every single time SuSEconfig is invoked. If you don't want this, but still want it run run with SuSEconfig, you can add a counter to the above script, so that say, after 50 SuSEconfig runs, the script would run. Here is a link on bash programming to give you some examples on counters; http://www.faqs.org/docs/Linux-HOWTO/Bash-...ntro-HOWTO.html |
|
|||
|
So, ok, I asked yaloki about the counter since I am new to bash scripting. Yaloki came up with this;
Code:
#!/bin/bash # default value if not defined in /etc/sysconfig/zyppdefrag: ZYPP_DEFRAG_EVERY=5 # read config but don't fail if the file doesn't exist . /etc/sysconfig/zyppdefrag &>/dev/null count=$(cat /var/adm/SuSEconfig/zyppdefrag-count 2>/dev/null || echo 0) count=$(( $count + 1 )) echo $count > /var/adm/SuSEconfig/zyppdefrag-count [ "$count" -lt 10 ] && exit 0 sqlite3 /var/cache/zypp/zypp.db vacuum rpm --rebuilddb******** # takes long for fn in****** /var/cache/zypp/zypp.db \ ****************/var/lib/rpm/Packages** \ ****************/var/lib/rpm/Filemd5s** \ ****************/var/lib/rpm/Dirnames** \ ****************/var/lib/rpm/Basenames do ********/bin/cp "$fn" "$fn.new" || exit 1 ********/bin/rm "$fn" ********/bin/mv "$fn.new" "$fn" done echo 0 > /var/adm/SuSEconfig/zyppdefrag-count Code:
## Path:********** System/Zypp/Defragmentation ## Description:****defragment the RPM and zypp databases ## Type:********** integer ## Default:********"5" # # After how many runs of SuSEconfig should the RPM # and zypp databases be defragemented ? # ZYPP_DEFRAG_EVERY="5" |
|
|||
|
And here is a picture.
[attachmentid=1798] Now, if you do a lot of installing/upgrading or removing packages (like I do) then maybe an interval of 5 is ok, otherwise change the number to a higher value. If all you do is the security updates, setting the value to 50 might be more appropriate. |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|