Skip to content

Commit

Permalink
Add systemctl.sh to handle Varnish service and integrate Varnish with…
Browse files Browse the repository at this point in the history
… t3c-apply
  • Loading branch information
AbdelrahmanElawady committed Jul 28, 2023
1 parent 6a59baa commit 6a5c26a
Show file tree
Hide file tree
Showing 11 changed files with 176 additions and 50 deletions.
3 changes: 3 additions & 0 deletions cache-config/t3c-apply/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ type Cfg struct {
Version string
GitRevision string
LocalATSVersion string
CacheType string
}

func (cfg Cfg) AppVersion() string { return t3cutil.VersionStr(AppName, cfg.Version, cfg.GitRevision) }
Expand Down Expand Up @@ -277,6 +278,7 @@ func GetCfg(appVersion string, gitRevision string) (Cfg, error) {
defaultClientTLSVersions := getopt.StringLong("default-client-tls-versions", 'V', "", "Comma-delimited list of default TLS versions for Delivery Services with no Parameter, e.g. --default-tls-versions='1.1,1.2,1.3'. If omitted, all versions are enabled.")
maxmindLocationPtr := getopt.StringLong("maxmind-location", 'M', "", "URL of a maxmind gzipped database file, to be installed into the trafficserver etc directory.")
verbosePtr := getopt.CounterLong("verbose", 'v', `Log verbosity. Logging is output to stderr. By default, errors are logged. To log warnings, pass '-v'. To log info, pass '-vv'. To omit error logging, see '-s'`)
cache := getopt.StringLong("cache", 'T', "ats", "Cache server type. Generate configuration files for specific cache server type, e.g. 'ats', 'varnish'.")

Check warning on line 281 in cache-config/t3c-apply/config/config.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/config/config.go#L281

Added line #L281 was not covered by tests
const silentFlagName = "silent"
silentPtr := getopt.BoolLong(silentFlagName, 's', `Silent. Errors are not logged, and the 'verbose' flag is ignored. If a fatal error occurs, the return code will be non-zero but no text will be output to stderr`)

Expand Down Expand Up @@ -612,6 +614,7 @@ If any of the related flags are also set, they override the mode's default behav
Version: appVersion,
GitRevision: gitRevision,
LocalATSVersion: atsVersionStr,
CacheType: *cache,

Check warning on line 617 in cache-config/t3c-apply/config/config.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/config/config.go#L617

Added line #L617 was not covered by tests
}

if err = log.InitCfg(cfg); err != nil {
Expand Down
8 changes: 4 additions & 4 deletions cache-config/t3c-apply/t3c-apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func Main() int {
}

} else {
syncdsUpdate, err = trops.CheckSyncDSState(metaData)
syncdsUpdate, err = trops.CheckSyncDSState(metaData, cfg)

Check warning on line 223 in cache-config/t3c-apply/t3c-apply.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/t3c-apply.go#L223

Added line #L223 was not covered by tests
if err != nil {
log.Errorln("Checking syncds state: " + err.Error())
return GitCommitAndExit(ExitCodeSyncDSError, FailureExitMsg, cfg, metaData, oldMetaData)
Expand All @@ -241,7 +241,7 @@ func Main() int {
} else if rc == 0 {
log.Infoln("updated the remap.config for reloading.")
}
if err := trops.StartServices(&syncdsUpdate, metaData); err != nil {
if err := trops.StartServices(&syncdsUpdate, metaData, cfg); err != nil {

Check warning on line 244 in cache-config/t3c-apply/t3c-apply.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/t3c-apply.go#L244

Added line #L244 was not covered by tests
log.Errorln("failed to start services: " + err.Error())
metaData.PartialSuccess = true
return GitCommitAndExit(ExitCodeServicesError, PostConfigFailureExitMsg, cfg, metaData, oldMetaData)
Expand Down Expand Up @@ -311,7 +311,7 @@ func Main() int {
}
}

if err := trops.StartServices(&syncdsUpdate, metaData); err != nil {
if err := trops.StartServices(&syncdsUpdate, metaData, cfg); err != nil {

Check warning on line 314 in cache-config/t3c-apply/t3c-apply.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/t3c-apply.go#L314

Added line #L314 was not covered by tests
log.Errorln("failed to start services: " + err.Error())
metaData.PartialSuccess = true
return GitCommitAndExit(ExitCodeServicesError, PostConfigFailureExitMsg, cfg, metaData, oldMetaData)
Expand Down Expand Up @@ -373,7 +373,7 @@ func GitCommitAndExit(exitCode int, exitMsg string, cfg config.Cfg, metaData *t3
// so add the old files to the new metadata.
// This is especially important for reval runs, which don't add all files.
metaData.OwnedFilePaths = t3cutil.CombineOwnedFilePaths(metaData, oldMetaData)
if len(metaData.InstalledPackages) == 0 {
if len(metaData.InstalledPackages) == 0 && oldMetaData != nil {

Check warning on line 376 in cache-config/t3c-apply/t3c-apply.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/t3c-apply.go#L376

Added line #L376 was not covered by tests
metaData.InstalledPackages = oldMetaData.InstalledPackages
}
WriteMetaData(cfg, metaData)
Expand Down
1 change: 1 addition & 0 deletions cache-config/t3c-apply/torequest/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func generate(cfg config.Cfg) ([]t3cutil.ATSConfigFile, error) {
args := []string{
`generate`,
"--dir=" + cfg.TsConfigDir,
"--cache=" + cfg.CacheType,

Check warning on line 75 in cache-config/t3c-apply/torequest/cmd.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/torequest/cmd.go#L75

Added line #L75 was not covered by tests
}

if cfg.LogLocationErr == log.LogLocationNull {
Expand Down
30 changes: 20 additions & 10 deletions cache-config/t3c-apply/torequest/torequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ func (r *TrafficOpsReq) CheckRevalidateState(sleepOverride bool) (UpdateStatus,

// CheckSyncDSState retrieves and returns the DS Update status from Traffic Ops.
// The metaData is this run's metadata. It must not be nil, and this function may add to it.
func (r *TrafficOpsReq) CheckSyncDSState(metaData *t3cutil.ApplyMetaData) (UpdateStatus, error) {
func (r *TrafficOpsReq) CheckSyncDSState(metaData *t3cutil.ApplyMetaData, cfg config.Cfg) (UpdateStatus, error) {

Check warning on line 745 in cache-config/t3c-apply/torequest/torequest.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/torequest/torequest.go#L745

Added line #L745 was not covered by tests
updateStatus := UpdateTropsNotNeeded
randDispSec := time.Duration(0)
log.Debugln("Checking syncds state.")
Expand Down Expand Up @@ -779,7 +779,7 @@ func (r *TrafficOpsReq) CheckSyncDSState(metaData *t3cutil.ApplyMetaData) (Updat
}
} else if !r.Cfg.IgnoreUpdateFlag {
log.Errorln("no queued update needs to be applied. Running revalidation before exiting.")
r.RevalidateWhileSleeping(metaData)
r.RevalidateWhileSleeping(metaData, cfg)

Check warning on line 782 in cache-config/t3c-apply/torequest/torequest.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/torequest/torequest.go#L782

Added line #L782 was not covered by tests
return UpdateTropsNotNeeded, nil
} else {
log.Errorln("Traffic Ops is signaling that no update is waiting to be applied.")
Expand Down Expand Up @@ -1075,7 +1075,7 @@ func (r *TrafficOpsReq) ProcessPackagesWithMetaData(packageMetaData []string) er
return nil

Check warning on line 1075 in cache-config/t3c-apply/torequest/torequest.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/torequest/torequest.go#L1075

Added line #L1075 was not covered by tests
}

func (r *TrafficOpsReq) RevalidateWhileSleeping(metaData *t3cutil.ApplyMetaData) (UpdateStatus, error) {
func (r *TrafficOpsReq) RevalidateWhileSleeping(metaData *t3cutil.ApplyMetaData, cfg config.Cfg) (UpdateStatus, error) {

Check warning on line 1078 in cache-config/t3c-apply/torequest/torequest.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/torequest/torequest.go#L1078

Added line #L1078 was not covered by tests
updateStatus, err := r.CheckRevalidateState(true)
if err != nil {
return updateStatus, err
Expand All @@ -1099,7 +1099,7 @@ func (r *TrafficOpsReq) RevalidateWhileSleeping(metaData *t3cutil.ApplyMetaData)
t3cutil.WriteActionLog(t3cutil.ActionLogActionUpdateFilesReval, t3cutil.ActionLogStatusSuccess, metaData)
}

if err := r.StartServices(&updateStatus, metaData); err != nil {
if err := r.StartServices(&updateStatus, metaData, cfg); err != nil {

Check warning on line 1102 in cache-config/t3c-apply/torequest/torequest.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/torequest/torequest.go#L1102

Added line #L1102 was not covered by tests
return updateStatus, errors.New("failed to start services: " + err.Error())
}

Expand All @@ -1116,7 +1116,7 @@ func (r *TrafficOpsReq) RevalidateWhileSleeping(metaData *t3cutil.ApplyMetaData)
// StartServices reloads, restarts, or starts ATS as necessary,
// according to the changed config files and run mode.
// Returns nil on success or any error.
func (r *TrafficOpsReq) StartServices(syncdsUpdate *UpdateStatus, metaData *t3cutil.ApplyMetaData) error {
func (r *TrafficOpsReq) StartServices(syncdsUpdate *UpdateStatus, metaData *t3cutil.ApplyMetaData, cfg config.Cfg) error {

Check warning on line 1119 in cache-config/t3c-apply/torequest/torequest.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/torequest/torequest.go#L1119

Added line #L1119 was not covered by tests
serviceNeeds := t3cutil.ServiceNeedsNothing
if r.Cfg.ServiceAction == t3cutil.ApplyServiceActionFlagRestart {
serviceNeeds = t3cutil.ServiceNeedsRestart
Expand All @@ -1138,13 +1138,17 @@ func (r *TrafficOpsReq) StartServices(syncdsUpdate *UpdateStatus, metaData *t3cu
serviceNeeds = t3cutil.ServiceNeedsReload
}
}
packageName := "trafficserver"
if cfg.CacheType == "varnish" {
packageName = "varnish"
}

Check warning on line 1144 in cache-config/t3c-apply/torequest/torequest.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/torequest/torequest.go#L1141-L1144

Added lines #L1141 - L1144 were not covered by tests

if (serviceNeeds == t3cutil.ServiceNeedsRestart || serviceNeeds == t3cutil.ServiceNeedsReload) && !r.IsPackageInstalled("trafficserver") {
if (serviceNeeds == t3cutil.ServiceNeedsRestart || serviceNeeds == t3cutil.ServiceNeedsReload) && !r.IsPackageInstalled(packageName) {

Check warning on line 1146 in cache-config/t3c-apply/torequest/torequest.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/torequest/torequest.go#L1146

Added line #L1146 was not covered by tests
// TODO try to reload/restart anyway? To allow non-RPM installs?
return errors.New("trafficserver needs " + serviceNeeds.String() + " but is not installed.")
return errors.New(packageName + " needs " + serviceNeeds.String() + " but is not installed.")

Check warning on line 1148 in cache-config/t3c-apply/torequest/torequest.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/torequest/torequest.go#L1148

Added line #L1148 was not covered by tests
}

svcStatus, _, err := util.GetServiceStatus("trafficserver")
svcStatus, _, err := util.GetServiceStatus(packageName)

Check warning on line 1151 in cache-config/t3c-apply/torequest/torequest.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/torequest/torequest.go#L1151

Added line #L1151 was not covered by tests
if err != nil {
return errors.New("getting trafficserver service status: " + err.Error())
}
Expand All @@ -1161,7 +1165,7 @@ func (r *TrafficOpsReq) StartServices(syncdsUpdate *UpdateStatus, metaData *t3cu
if svcStatus != util.SvcRunning {
startStr = "start"
}
if _, err := util.ServiceStart("trafficserver", startStr); err != nil {
if _, err := util.ServiceStart(packageName, startStr); err != nil {

Check warning on line 1168 in cache-config/t3c-apply/torequest/torequest.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/torequest/torequest.go#L1168

Added line #L1168 was not covered by tests
t3cutil.WriteActionLog(t3cutil.ActionLogActionATSRestart, t3cutil.ActionLogStatusFailure, metaData)
return errors.New("failed to restart trafficserver")
}
Expand All @@ -1188,7 +1192,13 @@ func (r *TrafficOpsReq) StartServices(syncdsUpdate *UpdateStatus, metaData *t3cu
log.Errorln("ATS configuration has changed. The new config will be picked up the next time ATS is started.")
} else if serviceNeeds == t3cutil.ServiceNeedsReload {
log.Infoln("ATS configuration has changed, Running 'traffic_ctl config reload' now.")
if _, _, err := util.ExecCommand(config.TSHome+config.TrafficCtl, "config", "reload"); err != nil {
reloadCommand := config.TSHome + config.TrafficCtl
reloadArgs := []string{"config", "reload"}
if cfg.CacheType == "varnish" {
reloadCommand = "varnishreload"
reloadArgs = []string{}
}
if _, _, err := util.ExecCommand(reloadCommand, reloadArgs...); err != nil {

Check warning on line 1201 in cache-config/t3c-apply/torequest/torequest.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-apply/torequest/torequest.go#L1195-L1201

Added lines #L1195 - L1201 were not covered by tests
t3cutil.WriteActionLog(t3cutil.ActionLogActionATSReload, t3cutil.ActionLogStatusFailure, metaData)

if *syncdsUpdate == UpdateTropsNeeded {
Expand Down
15 changes: 13 additions & 2 deletions cache-config/t3c-generate/cfgfile/varnish.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cfgfile

import (
"github.com/apache/trafficcontrol/cache-config/t3c-generate/config"
"github.com/apache/trafficcontrol/cache-config/t3cutil"
"github.com/apache/trafficcontrol/lib/varnishcfg"
)
Expand All @@ -26,10 +27,20 @@ import (

// GetVarnishConfigs returns varnish configuration files
// TODO: add varnishncsa and hitch configs
func GetVarnishConfigs(toData *t3cutil.ConfigData) (string, error) {
func GetVarnishConfigs(toData *t3cutil.ConfigData, cfg config.Cfg) ([]t3cutil.ATSConfigFile, error) {
vclBuilder := varnishcfg.NewVCLBuilder(toData)
vcl, warnings, err := vclBuilder.BuildVCLFile()
logWarnings("Generating varnish configuration files: ", warnings)

return vcl, err
configs := make([]t3cutil.ATSConfigFile, 0)
// TODO: should be parameterized and generated from varnishcfg
configs = append(configs, t3cutil.ATSConfigFile{
Name: "default.vcl",
Text: vcl,
Path: cfg.Dir,
ContentType: "text/plain; charset=us-ascii",
LineComment: "//",
Secure: false,
})
return configs, err

Check warning on line 45 in cache-config/t3c-generate/cfgfile/varnish.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-generate/cfgfile/varnish.go#L30-L45

Added lines #L30 - L45 were not covered by tests
}
9 changes: 6 additions & 3 deletions cache-config/t3c-generate/t3c-generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,16 @@ func main() {
}

if cfg.Cache == "varnish" {
vcl, err := cfgfile.GetVarnishConfigs(toData)
configs, err := cfgfile.GetVarnishConfigs(toData, cfg)
if err != nil {
log.Errorln("Generating varnish config for'" + *toData.Server.HostName + "': " + err.Error())
os.Exit(config.ExitCodeErrGeneric)
}
// TODO: print json for t3c-apply to consume. will be done with t3c-apply changes
fmt.Println(vcl)
err = cfgfile.WriteConfigs(configs, os.Stdout)
if err != nil {
log.Errorln("Writing configs for '" + *toData.Server.HostName + "': " + err.Error())
os.Exit(config.ExitCodeErrGeneric)
}
os.Exit(config.ExitCodeSuccess)

Check warning on line 99 in cache-config/t3c-generate/t3c-generate.go

View check run for this annotation

Codecov / codecov/patch

cache-config/t3c-generate/t3c-generate.go#L88-L99

Added lines #L88 - L99 were not covered by tests
}

Expand Down
40 changes: 13 additions & 27 deletions infrastructure/cdn-in-a-box/varnish/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,16 @@ ARG RHEL_VERSION=8
# Makes RHEL_VERSION available at runtime
ENV RHEL_VERSION="$RHEL_VERSION"

RUN dnf install -y 'dnf-command(config-manager)'
RUN yum config-manager --set-enabled powertools
RUN yum install -y diffutils python3-sphinx

RUN yum install -y epel-release && yum install -y \
make \
autoconf \
automake \
jemalloc-devel \
libedit-devel \
libtool \
libunwind-devel \
ncurses-devel \
pcre2-devel \
pkgconfig \
python3-docutils \
cpio \
git \
perl \
jq \
gettext

RUN dnf install -y bind-utils kyotocabinet-libs initscripts iproute net-tools nmap-ncat gettext autoconf automake libtool gcc-c++ cronie glibc-devel openssl-devel && \
dnf install -y logrotate && \
RUN dnf module disable varnish -y && yum install -y epel-release

RUN curl -s https://packagecloud.io/install/repositories/varnishcache/varnish73/script.rpm.sh | bash

RUN yum install varnish-7.3.0-1.el8.x86_64 -y

RUN dnf install -y bind-utils kyotocabinet-libs initscripts iproute net-tools nmap-ncat gettext autoconf automake libtool gcc-c++ cronie glibc-devel openssl-devel git perl && \
dnf install -y jq logrotate findutils && \
dnf clean all

RUN curl -O https://varnish-cache.org/downloads/varnish-7.3.0.tgz && tar xf varnish-7.3.0.tgz
RUN cd varnish-7.3.0 && sh autogen.sh && sh configure && make && make install
RUN rm -rf varnish*

COPY infrastructure/cdn-in-a-box/varnish/run.sh infrastructure/cdn-in-a-box/traffic_ops/to-access.sh infrastructure/cdn-in-a-box/enroller/server_template.json /

Expand All @@ -59,11 +40,16 @@ COPY infrastructure/cdn-in-a-box/dns/set-dns.sh \
/usr/local/sbin/


COPY infrastructure/cdn-in-a-box/varnish/systemctl.sh /usr/bin/systemctl

ARG ORT_RPM=infrastructure/cdn-in-a-box/cache/trafficcontrol-cache-config.rpm
COPY $ORT_RPM /
RUN rpm -Uvh /$(basename $ORT_RPM) &&\
rm /$(basename $ORT_RPM)

COPY infrastructure/cdn-in-a-box/varnish/traffic_ops_ort.crontab /etc/cron.d/traffic_ops_ort-cron-template


CMD /run.sh

FROM common-varnish-cache-config-layers AS mid
Expand Down
6 changes: 3 additions & 3 deletions infrastructure/cdn-in-a-box/varnish/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

trap 'echo "Error on line ${LINENO} of ${0}"; exit 1' ERR
set -o errexit -o nounset -o pipefail -o xtrace -o monitor
env > /ciab.env

mkdir /tmp/ort

Expand Down Expand Up @@ -72,21 +73,20 @@ until [[ $(to-get "api/4.0/cdns/name/$CDN_NAME/sslkeys" | jq '.response | length
echo 'waiting for SSL keys to exist'
sleep 3
done
mkdir -p /tmp/trafficcontrol-cache-config

# hostname is already defined in /etc/init.d/99-run.sh
hostname="${hostname//-/_}" # replace - with _
hostname="${hostname^^}" # uppercase
debug_variable_name="T3C_DEBUG_COMPONENT_${hostname}"
debug_binary="${!debug_variable_name}"
if ! type -p "$debug_binary"; then
mkdir -p /etc/varnish/
(t3c request --get-data=config --traffic-ops-url="$TO_URL" --traffic-ops-user="$TO_USER" --traffic-ops-password="$TO_PASSWORD" | t3c generate --cache=varnish | tee /etc/varnish/default.vcl) || { echo "Failed"; }
t3c apply --cache=varnish --run-mode=badass --traffic-ops-url="$TO_URL" --traffic-ops-user="$TO_USER" --traffic-ops-password="$TO_PASSWORD" --git=yes -vv || { echo "Failed"; }
fi

envsubst < "/etc/cron.d/traffic_ops_ort-cron-template" > "/etc/cron.d/traffic_ops_ort-cron" && rm -f "/etc/cron.d/traffic_ops_ort-cron-template"
chmod "0644" "/etc/cron.d/traffic_ops_ort-cron" && crontab "/etc/cron.d/traffic_ops_ort-cron"

crond -im off
varnishd -f /etc/varnish/default.vcl

varnishlog
94 changes: 94 additions & 0 deletions infrastructure/cdn-in-a-box/varnish/systemctl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/bin/bash

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

VARNISHD_EXECUTABLE="/usr/sbin/varnishd"

is_varnishd_running() {
pgrep -x "$(basename "$VARNISHD_EXECUTABLE")" >/dev/null
}

start_varnishd() {
if is_varnishd_running; then
echo "varnishd is already running."
else
echo "Starting varnishd..."
"$VARNISHD_EXECUTABLE" -f /opt/trafficserver/etc/trafficserver/default.vcl
echo "varnishd is now running."
fi
}

stop_varnishd() {
if is_varnishd_running; then
echo "Stopping varnishd..."

# Send SIGTERM signal to varnishd to terminate gracefully
pkill -x "$(basename "$VARNISHD_EXECUTABLE")"

# Wait for varnishd to stop, giving it a timeout of 10 seconds
timeout=10
while is_varnishd_running; do
if ((timeout-- == 0)); then
echo "Timed out waiting for varnishd to stop. Sending SIGKILL..."
pkill -9 -x "$(basename "$VARNISHD_EXECUTABLE")"
break
fi
sleep 1
done

if is_varnishd_running; then
echo "Failed to stop varnishd."
else
echo "varnishd is stopped."
fi
else
echo "varnishd is not running."
fi
}

restart_varnishd() {
echo "Restarting varnishd..."
stop_varnishd
start_varnishd
}

case "$1" in
enable)
exit 0
;;
start)
start_varnishd
;;
stop)
stop_varnishd
;;
restart)
restart_varnishd
;;
status)
if is_varnishd_running; then
exit 0
fi
exit 3
;;
*)
echo "Usage: $0 {start|stop|restart|enable|status}"
exit 1
esac

exit 0
Loading

0 comments on commit 6a5c26a

Please sign in to comment.