From 73bacd1bbc419849dd9fa5583242b43169f6a8bf Mon Sep 17 00:00:00 2001 From: Britney Fransen Date: Wed, 4 Feb 2015 17:38:10 +0000 Subject: LinHES-system: etc_care.cron: add to cron.weekly to remove old backup files in /etc --- abs/core/LinHES-system/PKGBUILD | 6 ++++-- abs/core/LinHES-system/etc_care.cron | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100755 abs/core/LinHES-system/etc_care.cron diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD index 7bf4a0b..9fdc47b 100755 --- a/abs/core/LinHES-system/PKGBUILD +++ b/abs/core/LinHES-system/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-system pkgver=8.3 -pkgrel=2 +pkgrel=3 arch=('i686' 'x86_64') install=system.install pkgdesc="Everything that makes LinHES an automated system" @@ -28,7 +28,7 @@ binfiles="LinHES-start optimize_mythdb.py myth_mtc.py mythwelcome-config.py mythwelcome-set-alarm.sh mythwelcome-test-wakeup.sh" source=(LinHES-session LinHES-profile.sh $binfiles - alsa-base cacheclean.cron myth_mtc.cron xfs_defrag.cron + alsa-base cacheclean.cron myth_mtc.cron xfs_defrag.cron etc_care.cron readme_is_xml readme_light add_storage.readme system-sudo.rules msg.cfg) @@ -62,6 +62,7 @@ package() { #install -m755 -D $srcdir/smolt.cron $pkgdir/etc/cron.weekly/smolt.cron install -m755 -D $srcdir/cacheclean.cron $pkgdir/etc/cron.weekly/cacheclean install -m755 -D $srcdir/xfs_defrag.cron $pkgdir/etc/cron.weekly/xfs_defrag + install -m755 -D $srcdir/etc_care.cron $pkgdir/etc/cron.weekly/etc_care install -m755 -D $srcdir/myth_mtc.cron $pkgdir/etc/cron.hourly/myth_mtc #sudo rules @@ -133,6 +134,7 @@ md5sums=('8415c4b2587a8a1e6a312484c1edafcb' '02c810c2f47b7c4495fdacaf54189473' 'fae4162988de9525ba3f9341e17f9c52' '474d5c6883fcfffae4f199aceb3b1356' + '8fe800181dcdf45bb7d7b36e4de8409e' '36bdfa8d877cea20ca3870faf08e08d5' '59d0602bac7e06f11abba1894acc8bb0' 'b12bbf3e028f51b08acef2799a5708bc' diff --git a/abs/core/LinHES-system/etc_care.cron b/abs/core/LinHES-system/etc_care.cron new file mode 100755 index 0000000..0a87201 --- /dev/null +++ b/abs/core/LinHES-system/etc_care.cron @@ -0,0 +1,16 @@ +#!/bin/bash +MYTH_RUN_STATUS=1 +. /etc/profile + +KeepBackups=4 + +for f in "/etc/lircd.conf" "/etc/lircrc" "/etc/remote.run" "/etc/asound.conf" +do + NumBackups=`ls -d $f-* | wc -l` + if [[ $NumBackups -gt $KeepBackups ]] + then + echo "Deleting old $f-* files..." + numdel=$(($NumBackups-$KeepBackups)) + rm -rf `ls -t $f-* | tail -$numdel` + fi +done -- cgit v0.12