#
#
DEGRADE_STATE=false
function setup
{
OLD_METHOD1="kill -HUP \`cat /var/run/syslog.pid\`"
OLD_METHOD2="kill -HUP \`cat /system/volatile/syslog.pid\`"
NEW_METHOD="/usr/sbin/svccfg -s $SVC_FMRI refresh"
if [ ! -f /etc/rsyslog.conf ]; then
echo "/etc/rsyslog.conf not found. Exiting."
exit $SMF_EXIT_ERR_CONFIG
fi
exit $SMF_EXIT_ERR_CONFIG
fi
exit $SMF_EXIT_ERR_CONFIG
fi
# remove once "system-log/default" has been renamed to "syslog" in ON
echo "$DEFAULT_FMRI conflicts with this instance and must be disabled first. Exiting."
exit $SMF_EXIT_ERR_CONFIG
fi
echo "$SYSLOG_FMRI conflicts with this instance and must be disabled first. Exiting."
exit $SMF_EXIT_ERR_CONFIG
fi
if smf_is_globalzone; then
#
# Before [r]syslogd starts, save any messages from
# previous crash dumps so that messages appear
# in chronological order.
#
# Need to be root to use savecore
if [ -r /etc/dumpadm.conf ]; then
. /etc/dumpadm.conf
/usr/bin/savecore -m -f $DUMPADM_DEVICE
fi
fi
fi
# Convert the old PID-file based post-command for logadm to an SMF-based one.
/usr/bin/cmp -s $LOGADM_CONF $TMP_CONF
if [ $? -eq 0 ]; then
else
# In case the umask or group is odd.
mode=$(/usr/bin/stat -c %a $LOGADM_CONF)
owner_group=$(/usr/bin/stat -c %U:%G $LOGADM_CONF)
fi
}
function check_update
{
# only do one transition/degrade
if [ -f $TRANSITION_FILE ]; then
return 0
fi
# cksum's of /etc/rsyslog.conf
RSYSLOG_CKSUM_1=3811874833 # s11.1, s11.2, s11.3
RSYSLOG_CKSUM_2=53416708 # s12
# cksum's of /etc/syslog.conf
SYSLOG_CKSUM_1=681212404 # s11, s11.1
SYSLOG_CKSUM_2=2956275192 # s11.2, s11.3, s12
if [ $? -ne 0 ]; then
# very abnormal state; bail out
echo "cksum /etc/rsyslog.conf failed. Exiting."
exit $SMF_EXIT_ERR_CONFIG
else
fi
if [ $? -ne 0 ]; then
# Don't care? Let rsyslog come up normal.
CKSUM_ETC_SYSLOG=$SYSLOG_CKSUM_2 # unmodified syslog.conf
else
fi
# if /etc/rsyslog.conf has NOT been modified
# AND
# if /etc/syslog.conf has been modified
# then there are customizations that may need migrating so
# exit DEGRADED
if ([ $CKSUM_ETC_RSYSLOG -eq $RSYSLOG_CKSUM_1 ] || \
[ $CKSUM_ETC_RSYSLOG -eq $RSYSLOG_CKSUM_2 ]) && \
([ $CKSUM_ETC_SYSLOG -ne $SYSLOG_CKSUM_1 ] && \
[ $CKSUM_ETC_SYSLOG -ne $SYSLOG_CKSUM_2 ]); then
echo "WARNING:"
echo "Bringing up rsyslog in a degraded state."
echo "man rsyslogd"
echo "And see NOTES for further instructions."
DEGRADE_STATE=true
fi
# and don't transition/degrade again
echo "#Successful transition from syslog to rsyslog completed."\
}
case "$1" in
'start')
if [ $? -ne 0 ]; then
return 1
fi
;;
'stop')
;;
'refresh')
;;
*)
echo "Usage: $0 { start | stop | refresh }"
exit 1
;;
esac
if [ ${DEGRADE_STATE} == true ]; then
"rsyslog.conf may need customizations"
fi
exit ${SMF_EXIT_OK}