163N/A#!/usr/bin/ksh93
163N/A
163N/A#
163N/A# CDDL HEADER START
163N/A#
163N/A# The contents of this file are subject to the terms of the
163N/A# Common Development and Distribution License (the "License").
163N/A# You may not use this file except in compliance with the License.
163N/A#
163N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
163N/A# or http://www.opensolaris.org/os/licensing.
163N/A# See the License for the specific language governing permissions
163N/A# and limitations under the License.
163N/A#
163N/A# When distributing Covered Code, include this CDDL HEADER in each
163N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
163N/A# If applicable, add the following below this CDDL HEADER, with the
163N/A# fields enclosed by brackets "[]" replaced with your own identifying
163N/A# information: Portions Copyright [yyyy] [name of copyright owner]
163N/A#
163N/A# CDDL HEADER END
163N/A#
163N/A# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
163N/A#
163N/A
163N/Asource /lib/svc/share/smf_include.sh
163N/A
163N/Atypeset -r SQUID_HOME=/usr/squid
163N/Atypeset -r CONF_FILE=/etc/squid/squid.conf
163N/Atypeset -r PIDFILE=/var/squid/logs/squid.pid
163N/Atypeset -r SQUID="${SQUID_HOME}/sbin/squid"
163N/A
163N/A[[ ! -f ${CONF_FILE} ]] && exit $SMF_EXIT_ERR_CONFIG
163N/A
163N/A
163N/Acase "$1" in
163N/Astart)
163N/A /bin/rm -f ${PIDFILE}
163N/A if [[ ! -d /var/squid/cache/00 ]] ; then
163N/A out="$(${SQUID} -z)"
163N/A fi
163N/A
163N/A exec ${SQUID} 2>&1
163N/A ;;
163N/Astop)
163N/A exec ${SQUID} -k shutdown 2>&1
163N/A ;;
163N/A*)
163N/A print "Usage: $0 {start|stop}"
163N/A exit 1
163N/A ;;
163N/Aesac
163N/A
163N/A# not reached