Created
July 10, 2014 14:02
-
-
Save midwire/68e89175e0415c5efbcf to your computer and use it in GitHub Desktop.
Varnish service control script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| cmd=$1 | |
| PROG=/usr/local/opt/varnish3/sbin/varnishd | |
| VCL=/usr/local/etc/varnish/default.vcl | |
| OPTS="-n /usr/local/var/varnish -f $VCL -s malloc,1G -T localhost:6082 -a :6081" | |
| function start_varnish() { | |
| echo "Running [$PROG $OPTS]" | |
| $PROG $OPTS | |
| } | |
| function stop_varnish() { | |
| pkill varnishd | |
| } | |
| case $cmd in | |
| start ) | |
| start_varnish | |
| ;; | |
| stop ) | |
| stop_varnish | |
| ;; | |
| restart ) | |
| stop_varnish | |
| start_varnish | |
| ;; | |
| status ) | |
| x=`redis-cli time` | |
| if [ $? == 0 ]; then | |
| echo "Redis is running." | |
| else | |
| echo "Redis is NOT running." | |
| fi | |
| ;; | |
| * ) | |
| echo "Usage: $0 [status, start, stop, restart]" | |
| ;; | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment