svc-pkg-sysrepo revision 2349
26d8ffe715e74d1e67d268551449b780fec1b95fAutomatic Updater# CDDL HEADER START
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt# The contents of this file are subject to the terms of the
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt# Common Development and Distribution License (the "License").
26d8ffe715e74d1e67d268551449b780fec1b95fAutomatic Updater# You may not use this file except in compliance with the License.
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
26d8ffe715e74d1e67d268551449b780fec1b95fAutomatic Updater# or http://www.opensolaris.org/os/licensing.
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt# See the License for the specific language governing permissions
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt# and limitations under the License.
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt# When distributing Covered Code, include this CDDL HEADER in each
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
26d8ffe715e74d1e67d268551449b780fec1b95fAutomatic Updater# If applicable, add the following below this CDDL HEADER, with the
64affc54f96a2c71cbd10ed71e246ce0746259aaAutomatic Updater# fields enclosed by brackets "[]" replaced with your own identifying
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt# information: Portions Copyright [yyyy] [name of copyright owner]
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt# CDDL HEADER END
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
8ec3c085233cedb22b05da36e2773c8f357a7e45Automatic UpdaterLD_LIBRARY_PATH=${APACHE_HOME}/lib/64:${LD_LIBRARY_PATH}
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt if [ $? -eq 0 ] ; then
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater if [ $RESULT -ne 0 ]; then
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater check_failure $? "pkg.sysrepo failed to create Apache configuration"
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt # Start a cache cleaning daemon, scanning every 120 minutes,
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt # being intelligent about only running if the cache has changed,
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater # limiting the cache to ${SYSREPO_CACHE_MAX} megabytes, being
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater # nice about scheduling and removing empty directories if
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater /usr/bin/su pkg5srv -c "/usr/apache2/2.2/bin/htcacheclean \
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater -d120 -i -l ${SYSREPO_CACHE_MAX}M -n \
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater -p ${SYSREPO_CACHE_DIR} \
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater -P ${SYSREPO_CACHE_DIR}/../sysrepo_htcacheclean.pid \
8ec3c085233cedb22b05da36e2773c8f357a7e45Automatic Updater check_failure $? "htcacheclean failed to run cleanly"
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater if [ -f ${SYSREPO_CACHE_DIR}/../sysrepo_htcacheclean.pid ]; then
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater PID=$(< ${SYSREPO_CACHE_DIR}/../sysrepo_htcacheclean.pid)
8ec3c085233cedb22b05da36e2773c8f357a7e45Automatic Updater check_failure $? "failed to kill htcacheclean process $PID"
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt ${HTTPD} -f ${SYSREPO_RUNTIME_DIR}/sysrepo_httpd.conf \
2895f101b5585a19015ac2c2c1e1812ac467fa12Automatic Updater check_failure $? "Server failed to start. Check the SMF service log or the error log at ${SYSREPO_LOG_DIR}/error_log for more information, if any."
2895f101b5585a19015ac2c2c1e1812ac467fa12Automatic Updater ${HTTPD} -f ${SYSREPO_RUNTIME_DIR}/sysrepo_httpd.conf \
2895f101b5585a19015ac2c2c1e1812ac467fa12Automatic Updater check_failure $? "Server failed to refresh. Check the SMF service log or the error log at ${SYSREPO_LOG_DIR}/error_log for more information, if any."
2895f101b5585a19015ac2c2c1e1812ac467fa12Automatic Updater ${HTTPD} -f ${SYSREPO_RUNTIME_DIR}/sysrepo_httpd.conf \
2895f101b5585a19015ac2c2c1e1812ac467fa12Automatic Updater check_failure $? "Server failed to stop. Check the SMF service log or the error log at ${SYSREPO_LOG_DIR}/error_log for more information, if any."
2895f101b5585a19015ac2c2c1e1812ac467fa12Automatic Updater echo "Usage: $0 {start|stop|refresh}"