From 08f5ba1436b19d2e42e7b8ac5e40fc1b41da0148 Mon Sep 17 00:00:00 2001 From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Sat, 19 Dec 2009 18:47:47 +0000 Subject: [PATCH] Cygwin: Check for 'syslogd' and 'syslog-ng' in initd script. git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@3003 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- smartmontools/CHANGELOG | 2 ++ smartmontools/smartd.initd.in | 29 ++++++++++++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/smartmontools/CHANGELOG b/smartmontools/CHANGELOG index 8dc20b5a7..e2f1aab2c 100644 --- a/smartmontools/CHANGELOG +++ b/smartmontools/CHANGELOG @@ -43,6 +43,8 @@ NOTES FOR FUTURE RELEASES: see TODO file. <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE> + [CF] Cygwin: Check for 'syslogd' and 'syslog-ng' in initd script. + [CF] Windows: Disable Win9x/ME specific code if no longer supported by compiler. diff --git a/smartmontools/smartd.initd.in b/smartmontools/smartd.initd.in index 2cd36adb5..29dcaaa85 100755 --- a/smartmontools/smartd.initd.in +++ b/smartmontools/smartd.initd.in @@ -2,7 +2,7 @@ # smartmontools init file for smartd # Copyright (C) 2002-8 Bruce Allen <smartmontools-support@lists.sourceforge.net> -# $Id: smartd.initd.in,v 1.38 2008/03/04 22:09:47 ballen4705 Exp $ +# $Id$ # For RedHat and cousins: # chkconfig: 2345 40 40 @@ -439,15 +439,30 @@ http://smartmontools.sourceforge.net/" install) shift [ $# -eq 0 ] || smartd_opts="$*" - dep= + dep=; dep2= if cygrunsrv -L 2>/dev/null | grep "^syslogd$" >/dev/null 2>&1; then - dep="-y syslogd" + dep="syslogd" + fi + if cygrunsrv -L 2>/dev/null | grep "^syslog-ng" >/dev/null 2>&1; then + dep2="syslog-ng" + fi + if [ -z "$dep" ]; then + if [ -z "$dep2" ]; then + echo "Warning: no syslog service installed, smartd will write to windows event log."; + else + dep="$dep2" + fi else - echo "Warning: syslogd service not installed, smartd will write to windows event log."; + if [ -z "$dep2" ]; then + : + else + dep= + echo "Warning: both syslogd and syslog-ng installed, dependency not set." + fi fi - echo "Installing service ${smartd_svcname}${smartd_opts+ with options '$smartd_opts'}:" - cygrunsrv -I "$smartd_svcname" -d "$smartd_svcdisp" -f "$smartd_svcdesc" $dep \ - -e CYGWIN="$CYGWIN" -p $SMARTD_BIN -a "-n -p ${PID_FILE}${smartd_opts+ }$smartd_opts" + echo "Installing service ${smartd_svcname}${dep:+ (depending on '$dep')}${smartd_opts:+ with options '$smartd_opts'}:" + cygrunsrv -I "$smartd_svcname" -d "$smartd_svcdisp" -f "$smartd_svcdesc" ${dep:+-y} $dep \ + -e CYGWIN="$CYGWIN" -p $SMARTD_BIN -a "-n -p ${PID_FILE}${smartd_opts:+ }$smartd_opts" RETVAL=$? ;; remove) -- GitLab