2 if [ $0 != "./run" ];then
3 echo "This script meant to be linked as ./run in a service/log directory only!"
6 logdir
=$
(basename $
(pwd))
7 if [ "$logdir" != "log" ];then
8 echo "This script meant to be run from a service/log directory only!"
11 if [ -w /var
/log
];then
15 user_group
=${USERGROUP:-daemon:adm}
16 service
=$
(basename $
(dirname $
(pwd)))
17 [ -d "/var/log/$service" ] || mkdir
-p "/var/log/$service"
18 [ -L .
/main
] ||
[ -d .
/main
] ||
ln -s "/var/log/$service" .
/main
19 [ -L .
/current
] ||
ln -s main
/current
20 usergroup
=$
(stat
-c "%U:%G" "/var/log/$service")
21 if [ "$usergroup" != "$user_group" ];then
22 chown
-R $user_group "/var/log/$service"
24 echo Logging as
$user_group to
/var
/log
/$service
25 exec chpst
-u $user_group svlogd
-t .
/main