View gs-backup.sh
This file contains 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
#!/bin/bash | |
# Tar shit up: | |
today=$(date '+%d_%m_%y') | |
echo "* Performing domain backup..." | |
tar czf /var/backups/constantshift.com_"$today".tar.gz -C / var/www/constantshift.com | |
echo "* Backed up..." | |
# Remove shit older than 7 days: | |
MaxFileAge=7 | |
find /var/backups/ -name '*.gz' -type f -mtime +$MaxFileAge -exec rm -f {} \; | |
# Rsync shit to the grid: |
View apc
This file contains 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/perl | |
# | |
# Magic markers: | |
#%# family=auto | |
#%# capabilities=autoconf | |
my $ret = undef; | |
if (! eval "require LWP::UserAgent;") | |
{ |
View apcinfo.php
This file contains 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
<?php | |
$mem = apc_sma_info(); | |
$mem_size = $mem['num_seg']*$mem['seg_size']; | |
$mem_avail= $mem['avail_mem']; | |
$mem_used = $mem_size-$mem_avail; | |
$out = array( | |
'size: ' . sprintf("%.2f", $mem_size), | |
'used: ' . sprintf("%.2f", $mem_used), | |
'free: ' . sprintf("%.2f", $mem_avail) | |
); |
View memcached
This file contains 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/perl -w | |
# | |
# Copyright (C) 2008 Rodolphe Quiedeville <rodolphe@quiedeville.org> | |
# | |
# This program is free software; you can redistribute it and/or | |
# modify it under the terms of the GNU General Public License | |
# as published by the Free Software Foundation; version 2 dated June, | |
# 1991. | |
# | |
# This program is distributed in the hope that it will be useful, |
View memcached_hits
This file contains 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/perl -w | |
# | |
# Copyright (C) 2008 Rodolphe Quiedeville <rodolphe@quiedeville.org> | |
# | |
# This program is free software; you can redistribute it and/or | |
# modify it under the terms of the GNU General Public License | |
# as published by the Free Software Foundation; version 2 dated June, | |
# 1991. | |
# | |
# This program is distributed in the hope that it will be useful, |
View memcached_size
This file contains 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/perl -w | |
# | |
# Copyright (C) 2008 Rodolphe Quiedeville <rodolphe@quiedeville.org> | |
# | |
# This program is free software; you can redistribute it and/or | |
# modify it under the terms of the GNU General Public License | |
# as published by the Free Software Foundation; version 2 dated June, | |
# 1991. | |
# | |
# This program is distributed in the hope that it will be useful, |
View varnish_
This file contains 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/perl -w | |
# | |
# varnish_ - Munin plugin to for Varnish | |
# Copyright (C) 2009 Redpill Linpro AS | |
# | |
# Author: Kristian Lyngstøl <kristian@redpill-linpro.com> | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2 of the License, or |
View gist:477835
This file contains 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
add-apt-repository ppa:brianmercer/php | |
aptitude -y update | |
aptitude -y install php5-cli php5-common php5-mysql php5-suhosin php5-gd php5-curl | |
aptitude -y install php5-fpm php5-cgi php-pear php5-memcache php-apc php5-dev | |
echo "apc.mmap_file_mask=/tmp/apc.XXXXXX" >> /etc/php5/conf.d/apc.ini | |
echo "apc.shm_size = 64" >> /etc/php5/conf.d/apc.ini | |
cp /etc/php5/fpm/php5-fpm.conf /etc/php5/fpm/php5-fpm.conf.original | |
sed -i 's/.*listen.allowed_clients = 127.0.0.1.*/listen.allowed_clients = 127.0.0.1/g' /etc/php5/fpm/php5-fpm.conf |
View apachetest.sh
This file contains 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
#!/bin/bash | |
echo "This is intended as a guideline only!" | |
if [ -e /etc/debian_version ]; then | |
APACHE="apache2" | |
elif [ -e /etc/redhat-release ]; then | |
APACHE="httpd" | |
fi | |
RSS=`ps -aylC $APACHE |grep "$APACHE" |awk '{print $8'} |sort -n |tail -n 1` | |
RSS=`expr $RSS / 1024` | |
echo "Stopping $APACHE to calculate free memory" |
View nginx
This file contains 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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
OlderNewer