Bash script for adding a mysql instance

Because I wanted to use one server to replicate multiple mysql masters I had to create various mysql instances from the same mysql install, which got tedious, so I made a script. Just enter the idbase (that with the port appended will become your sever id for replication), the port and the password you want […]

Serverbear benchmark url

wget -N https://raw.github.com/Crowd9/Benchmark/master/sb.sh&&bash sb.sh ‘provider’ ‘plan’ ’email@domain.com’ ‘price’ private  

Quick server setup #2

For quick run: wget -N http://www.nat.li/wp-code/104.1.sh&&bash 104.1.sh   Explained: Install lighttpd along with mysql and some other useful applications. First of all, some useful/mandatory applications and mysql 1. Installs htop, rcconf, aptitude, vim, dos2unix and mysql apt-get -y –force-yes update apt-get -y –force-yes install htop aptitude rcconf vim dos2unix mysql-server Copy this next part to […]

Set-up redundant MySQL system

Note: Setting up the slave like this, means it can only be used to read.. don’t ever try to write to it because you will break replication. If you want to add writing to it, set replication up both ways and change the auto-increment-increment and auto-increment-offset on both/all servers to ensure the unique keys don’t […]

Add users to vsftpd

Source: linux-hacks.blogspot.nl #edit /etc/vsftpd.conf or /opt/etc/vsftpd.conf local_enable=YES chroot_list_file=/etc/vsftpd.chroot_list or /opt/etc/vsftpd.chroot_list chroot_list_enable=YES #You may alsow ant to disable anonymous access #You may also want to enable write access #Create vsftpd.chroot_list in /etc/ or /opt/etc/ Add the username you want to export to ftp. If the user you want to add is not a system user then […]

Show iptable blocks

#!/bin/bash range=”$1 $2″ cntonly=”$3″ if [[ $cntonly == “c” ]] ; then #Count only res=$(grep -c “$range.*iptables denied” /var/log/debug*) echo “$res” else #Get actual lines res=$(grep “$range.*iptables denied” /var/log/debug*) echo “$res” fi exit 1 Example usage: ./scriptname.sh Nov 11 Will show all dropped connections on November the 11th or ./scriptname.sh Nov 11 c Will show […]

Clear — MARK — from logs

Clear existing ones: sed ‘/.*MARK –/d’ messages > messagesf #Or replace on the spot: sed -i ‘/.*MARK –/d’ messages Only write it once per day: vim /etc/default/syslogd SYSLOGD=”-m 1440″

Debian VPS (OpenVZ) Quick Setup

Fix getty processes causing log file growth Comment out all but the first (tty1) getty entries vim /etc/inittab … # Note that on most Debian systems tty7 is used by the X Window System, # so if you want to add more getty’s go ahead but skip tty7 if you run X. # 1:2345:respawn:/sbin/getty 38400 […]

OpenVZ install on Debian 6.0

mkdir /var/openvz-dl cd /var/openvz-dl 86 wget http://download.openvz.org/kernel/branches/rhel6-2.6.32/042stab062.2/vzkernel-2.6.32-042stab062.2.i686.rpm wget http://download.openvz.org/kernel/branches/rhel6-2.6.32/042stab062.2/vzkernel-devel-2.6.32-042stab062.2.i686.rpm wget http://download.openvz.org/utils/vzctl/4.0/vzctl-4.0-1.i386.rpm wget http://download.openvz.org/utils/vzctl/4.0/vzctl-core-4.0-1.i386.rpm wget http://download.openvz.org/utils/ploop/1.5/ploop-1.5-1.i386.rpm wget http://download.openvz.org/utils/ploop/1.5/ploop-lib-1.5-1.x86_64.rpm wget http://download.openvz.org/utils/vzquota/3.1/vzquota-3.1-1.i386.rpm 64 wget http://download.openvz.org/kernel/branches/rhel6-2.6.32/042stab062.2/vzkernel-2.6.32-042stab062.2.x86_64.rpm wget http://download.openvz.org/kernel/branches/rhel6-2.6.32/042stab062.2/vzkernel-devel-2.6.32-042stab062.2.x86_64.rpm wget http://download.openvz.org/utils/vzctl/4.0/vzctl-4.0-1.x86_64.rpm wget http://download.openvz.org/utils/vzctl/4.0/vzctl-core-4.0-1.x86_64.rpm wget http://download.openvz.org/utils/ploop/1.5/ploop-1.5-1.x86_64.rpm wget http://download.openvz.org/utils/ploop/1.5/ploop-lib-1.5-1.x86_64.rpm wget http://download.openvz.org/utils/vzquota/3.1/vzquota-3.1-1.x86_64.rpm apt-get install fakeroot alien fakeroot alien –to-deb –scripts –keep-version vz*.rpm ploop*.rpm dpkg -i vz*.deb ploop*.deb –force-overwrite update-grub update-rc.d vz defaults update-rc.d […]

Using mod-cband to limit monthly bandwidth on apache2 vhosts

Install apt-get install apache2-dev cd var wget http://dembol.org/downloads/cband/mod-cband-0.9.7.5.tgz tar -zxvf mod-cband-0.9.7.5.tgz cd mod-cband-0.9.7.5 ./configure ———————————————————— Now open Makefile and edit the line APXS_OPTS=* to APXS_OPTS=-lm -Wc,-Wall -Wc,-DDST_CLASS=3 ———————————————————— make make install Example vhost <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/dom.ex/public_html/testblog ServerName testblog.dom.ex CBandLimit 100G CBandScoreboard /var/www/scoreboard CBandPeriod 4W #<Location /cband-status> #    SetHandler cband-status #</Location> <Location /cband-status-me> […]