File: back_act.sh

package info (click to toggle)
nn 6.7.3-8
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 2,508 kB
  • ctags: 3,199
  • sloc: ansic: 32,035; sh: 1,491; awk: 138; makefile: 98
file content (33 lines) | stat: -rw-r--r-- 606 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# prefix is inserted above by make

#
#	back_act will maintain a set of `old' active files
#	in the DB directory where they can be used by nngoback
#	to backtrack the rc file a number of days.
#
#	It should be invoked by cron every day at midnight.
#	It should run as user `news'!
#
#	Call:  back_act [days]
#	Default: keep copy of active file for the last 14 days.

cd $DB || exit 1

p=${1-15}
l=""
while [ "$p" -gt 0 ]
do
	i="`expr $p - 1`"
	if [ -f active.$i ]
	then
		mv active.$i active.$p
		l=$p
	elif [ -n "$l" ]
	then
		ln active.$l active.$p
	fi
	p=$i
done

cp $ACTIVE active.0
chmod 644 active.0