aboutsummaryrefslogtreecommitdiffstats
path: root/add-syslog
diff options
context:
space:
mode:
authorHerton Ronaldo Krzesinski <herton@mandriva.com.br>2005-08-04 18:26:13 +0000
committerHerton Ronaldo Krzesinski <herton@mandriva.com.br>2005-08-04 18:26:13 +0000
commit417615d96d52b8e011d5efbdff69f7216a53e194 (patch)
tree10d76b8426d53f32520c15e8edbd416b8823da85 /add-syslog
parent16c3994b6e45098fb0ceba032385e746a4a3ffee (diff)
downloadrpm-helper-417615d96d52b8e011d5efbdff69f7216a53e194.tar
rpm-helper-417615d96d52b8e011d5efbdff69f7216a53e194.tar.gz
rpm-helper-417615d96d52b8e011d5efbdff69f7216a53e194.tar.bz2
rpm-helper-417615d96d52b8e011d5efbdff69f7216a53e194.tar.xz
rpm-helper-417615d96d52b8e011d5efbdff69f7216a53e194.zip
- Fix usage bug: add-syslog and del-syslog can also accept only one
parameter, the unix stream log source. - Shell script must exit with 'exit' command, not 'return'. - Before using service command we must check if the initscript exist. - Fixed sed expression for adding a syslog source to syslog-ng inside the same source of /dev/log. - Removed duplicated comment. - We must check level if empty in del-syslog, in the case we're using only source argument, otherwise we get various grep usage erros.
Diffstat (limited to 'add-syslog')
-rwxr-xr-xadd-syslog11
1 files changed, 6 insertions, 5 deletions
diff --git a/add-syslog b/add-syslog
index 9f1a7e1..d1d0918 100755
--- a/add-syslog
+++ b/add-syslog
@@ -12,7 +12,7 @@
# syslog (supported sysklogd and syslog-ng).
#---------------------------------------------------------------
-if [ $# -lt 6 ]; then
+if [ $# -lt 3 ]; then
echo "usage: $0 <pkg name> <num installed> <source> <facility> <level_begin> <level_end> <log file>" 1>&2
exit 1
fi
@@ -74,7 +74,7 @@ logfile=$7 # log file, like /var/log/messages
# Don't readd entry on package updates
if [ "$num" -ne 1 ]; then
- return 0
+ exit 0
fi
# just ignore if it's default unix domain socket
@@ -163,6 +163,7 @@ if [ -f /etc/syslog.conf ]; then
echo -e "$facility.=$level_begin\t\t\t\t\t\t\t$logfile" >> /etc/syslog.conf
fi
fi
+ [ -f "/etc/rc.d/init.d/syslog" ] && service syslog condrestart
fi
# syslog-ng handler
@@ -222,13 +223,13 @@ if [ -f /etc/syslog-ng.conf ]; then
fi
fi
elif [ -n "$source" ]; then
- from=`echo $config | sed -n "s:\(.*source[[:space:]]\+\)\([[:alnum:]]\+\)\(.*/dev/log.*\):\2:p"`
if [ -n "$from" ]; then
- sed -i -e :a -e \
- "s:\(source[[:space:]]\+$from[[:space:]]*{[^}]*\)\(}[[:space:]]*\);:\1 unix-stream (\"$source\"); };:g;/source/N;//ba" \
+ sed -i \
+ "/source/{ :a /}/! { N; ba }; s:\(source[[:space:]]*$from[[:space:]]*{.*\)\([[:space:]]\+}[[:space:]]*;\):\1 unix-stream (\"$source\"); };: }" \
/etc/syslog-ng.conf
fi
fi
+ [ -f "/etc/rc.d/init.d/syslog-ng" ] && service syslog-ng condrestart
fi
exit 0