summary refs log tree commit diff
path: root/svlogtail
blob: 4daa2f929108af961b4e497440656ee1b6e58c15 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
# svlogtail [LOGS...] - show svlogd logs conveniently
#
# Without arguments, show current logs of all services, uniquely.
# With arguments, show all logs of mentioned services.

if [ $# = 0 ]; then
	cat /var/log/socklog/*/current | sort -u
	tail -Fq -n0 /var/log/socklog/*/current | uniq
else
	old=
	cur=
	for log; do
		if [ -d /var/log/socklog/$log ]; then
			old="$old /var/log/socklog/$log/*.[us]"
			cur="$cur /var/log/socklog/$log/current"
		else
			echo "no logs for $log" 1>&2
                        exit 1
		fi
	done
	cat $old $cur | sort
	tail -Fq -n0 $cur
fi