Skip to content

Instantly share code, notes, and snippets.

View rails3-nginx-passenger.sh
#!/bin/bash
##
## are you root?
##
if [ "$(whoami)" != "root" ]; then
echo "You need to be root to run this!"
exit 2
fi
View nginx
#! /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
@tjstein
tjstein / apachetest.sh
Created Sep 1, 2010
Find out what Apache MaxClients should be set to
View apachetest.sh
#!/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 gist:477835
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 varnish_
#!/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 memcached_size
#!/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
#!/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
#!/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 apcinfo.php
<?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 apc
#!/usr/bin/perl
#
# Magic markers:
#%# family=auto
#%# capabilities=autoconf
my $ret = undef;
if (! eval "require LWP::UserAgent;")
{