Define

Just a quick script for looking up the definition of a word via the commandline…

touch define
vim define

add the following code then :wq to save


#! /bin/bash
# display definition of a word
#
curl --stderr /dev/null dict://dict.org/d:$1 | sed '/^[.,0-9].*$/d'

then,

chmod +x define
mv define /usr/bin/define

Usage

# define linux
Linux
n : an open-source version of the UNIX operating system

Rsync Cpanel Server (Cloning)

This script will copy everything necessary for a full cpanel -> cpanel transfer. You need to open the script up and change 127.0.0.1 to the FQDN or IP of the target server. It will first create a key pair and then transfer it to the target server. Root level access is required for this script to work properly. After this runs you will need to update the network configuration on the new server and reboot or restart networking.
#!/bin/sh
#
# HOST = User + IP / Hostname to copy files TO.
HOST="root@PUTDESTINATIONIP"

echo Creating key pair...
ssh-keygen -t dsa
echo Create .ssh directory on destination server...
ssh $HOST 'mkdir /root/.ssh'
scp /root/.ssh/id_dsa.pub $HOST:~/.ssh/authorized_keys

# /etc User / IP's + passwd files
echo Transferring /etc
rsync -aqHl -e ssh /etc/passwd $HOST:/root/
rsync -aqHl -e ssh /etc/shadow $HOST:/root/
rsync -aqHl -e ssh /etc/group $HOST:/root/
rsync -aqHl -e ssh /etc/wwwacct.conf $HOST:/etc/
rsync -aqHl -e ssh /etc/quota.conf $HOST:/etc/
rsync -aqHl -e ssh /etc/domainalias $HOST:/etc/
rsync -aqHl -e ssh /etc/remotedomains $HOST:/etc/
rsync -aqHl -e ssh /etc/localdomains $HOST:/etc/
rsync -aqHl -e ssh /etc/userdomains $HOST:/etc/
rsync -aqHl -e ssh /etc/valiases $HOST:/etc/
rsync -aqHl -e ssh /etc/vfilters $HOST:/etc/
rsync -aqHl -e ssh /etc/vmail $HOST:/etc/
rsync -aqHl -e ssh /etc/trueuserdomains $HOST:/etc/
rsync -aqHl -e ssh /etc/trueuserowners $HOST:/etc/
rsync -aqHl -e ssh /etc/ips $HOST:/etc/
rsync -aqHl -e ssh /etc/ipaddresspool $HOST:/etc/
rsync -aqHl -e ssh /etc/services $HOST:/etc/

# ftpd files
echo Transferring FTP configs
rsync -aqHl -e ssh /etc/sysconfig/pure-ftpd $HOST:/etc/sysconfig/
rsync -aqHl -e ssh /etc/pure-ftpd.conf $HOST:/etc/
rsync -aqHl -e ssh /etc/pure-ftpd $HOST:/etc/
rsync -aqHl -e ssh /etc/proftpd $HOST:/etc/
rsync -aqHl -e ssh /etc/proftpd.* $HOST:/etc/

# /var
echo Transferring /var
rsync -aqHl -e ssh /var/cpanel $HOST:/var/
rsync -aqHl -e ssh /var/spool/cron $HOST:/var/spool/

# /usr config - 3rdparty
echo Transferring 3rd party and SSL certs
rsync -aqHl -e ssh /usr/share/ssl $HOST:/usr/share/
rsync -aqHl -e ssh/usr/local/cpanel/3rdparty/mailman $HOST:/usr/local/cpanel/3rdparty/
rsync -aqHl -e ssh /usr/local/cpanel/base/frontend $HOST/usr/local/cpanel/base/

# Apache
echo Transferring Apache configs
rsync -aqHl -e ssh /usr/local/apache/conf $HOST:/usr/local/apache/
rsync -aqHl -e ssh /usr/local/apache/libexec $HOST:/usr/local/apache/
rsync -aqHl -e ssh /usr/local/frontpage $HOST:/usr/local/

# Mysql config
echo Transferring MySQL configs
rsync -aqHl -e ssh /root/.my.cnf $HOST:/root/
rsync -aqHl -e ssh /etc/my.cnf $HOST:/etc/

# Named
echo Transferring zone files and bind configs
rsync -aqHl -e ssh /var/named $HOST:/var/
rsync -aqHl -e ssh /etc/named.conf $HOST:/etc/
rsync -aqHl -e ssh /etc/rndc.conf $HOST:/etc/

#User Files
# Mysql
echo Transferring MySQL databases
rsync -aqHl -e ssh /var/lib/mysql/* $HOST:/var/lib/mysql/

# Home
echo Tansferring /home
rsync -aqHl -e ssh /home/* $HOST:/home/

vpsinfo : server status in your browser

from http://www.labradordata.ca/home/13
vpsinfo is a Linux server monitoring script, written in PHP, that provides web access to system status information. It gathers the output from several common Linux commands into one web page, providing a quick overview of the system’s current state.

While designed for use on a Linux Virtuozzo or OpenVZ VPS (Virtual Private Server), vpsinfo also works fine on a dedicated server. When installed on a dedicated machine VPS-specific information is automatically excluded.

Please note that on Virtuozzo v. 3 and OpenVZ servers the small beanc helper app is required to access VPS status information. The helper app is not required for Virtuozzo v. 2.6 servers.
vpsinfo shows the following output:

* Output from top;
* Processed /proc/user_beancounters (VPS resources);
* Output from netstat -nt (current TCP connections);
* Output from netstat -ntl (listening TCP ports);
* Output from pstree (tree view of running processes);
* Output from ls -a /tmp (and ls -al /tmp);
* Output from vnstat (an application that monitors traffic at the network interface) using its various commandline switches;
* Output from mytop (an application that monitors MySQL) or from mysqlreport (a perl script which generates a mysql status report);
* Status monitoring of daemon processes;
* Summary section showing:
o Values for oomguarpages and privvmpages (or free RAM and swap usage on a dedicated machine);
o Data transfer today through the network interface (from vnstat);
o Current number of TCP connections;
o Current number of Apache and MySQL threads, and MySQL queries (from mytop or mysqlreport)
o Disk usage.

Requirements

* Linux;
* PHP: vpsinfo was initially developed with v. 4.3.10 and should run fine with later releases;
* The beanc helper app if running on a Virtuozzo v. 3 or OpenVZ server;
* PHP safe mode off. Safe mode disables the ability to run programs outside the script directory (reference).

Optional Third-party Software
These applications are not required to run vpsinfo, but if installed they are used to gather additional information:

* vnstat: an application to monitor data transfer at the network interface. Highly recommended!
* mytop: an application similar to ‘top’ but which monitors a MySQL server.
* mysqlreport: a perl script that generates an analysis of MySQL performance.

Installation
Important! If you have a Virtuozzo v. 3 or OpenVZ VPS you must also install the beanc helper app.

1. Get the file (in the Download section below);
2. Edit the configuration variables at the top;
3. Save it with a .php extension and place it on your webserver.

I strongly recommend you place it in a password-protected directory. You should not be exposing this much server information to everyone on the web.

Configuration
If you use either mytop or mysqlreport, you must edit the MySQL connection information. Supply a valid MySQL database name, username & password.

mytop is installed as a system application. The mytop website and the README file in the downloadable package will provide installation information.

mysqlreport is a perl script which you place in the same directory as vpsinfo. Once you have it in place you must make it executable by the webserver user:

* If you are running phpsuexec, then the mysqlreport script should be owned by the account user and chmod 700.
* If you are not using phpsuexec, then the mysqlreport script should be owned by the webserver user (e.g., ‘nobody’) and chmod 700. Check your system to find the username which the webserver runs as. If you do not have sufficient previledges to change ownership of the script, then the script must be made world-executable, e.g., chmod 777.

Note: vpsinfo may fail to correctly execute mysqlreport if your MySQL password contains non-alphanumeric characters. If you get a “denied access to mysql” message, try a simpler alphanumeric password.
Other configuration items are optional and are explained in the configuration section of the script.

Download
Here is the script as a plain-text file:
vpsinfo.txt. Save it as “vpsinfo.php”.

e – Extract Any Archive

With this little tool you can extract almost any archive in Linux so you do not need to remember which tool and what command lines are necessary.

Usage:
# Extract a zip file: e file.zip
# Extract a rar file: e file.rar
# Extract several archives, one after another: e a.tar.gz b.tar.bz2 c.cab d.deb e.rpm
# Extract every file from the current directory: e *
Download e Here

sudo apt-get install ruby
wget http://martin.ankerl.com/files/e
chmod a+x e
sudo mv e /usr/local/bin

Thanks to martin.ankerl.com

DomainKeys Install

Here is a little script that will add domainkeys to all cpanel user accounts.

#!/bin/bash
for i in `ls /var/cpanel/users` ;do /usr/local/cpanel/bin/domain_keys_installer $i ;done
cd /var/named
localdomains=$(cat /etc/localdomains | grep '^[^.]*\.[^.]*$' | uniq -u)
for i in $localdomains
do
echo "_domainkey IN TXT "t=y; o=~; n=Interim Sending Domain Policy; r=root@$HOSTNAME"" >> $i.db
done
wget http://layer3.liquidweb.com/updateserial.pl -O /var/named/updateserial.pl
cd /var/named
perl /var/named/updateserial.pl .

chmod +x scriptname.sh
./scriptname.sh

FFMpeg Install

1) Install ffmpeg via admin-ahead.com (http://scriptmantra.info/ffmpeg.html)
2) Register here: http://installers.admin-ahead.com/ (Name, Email, Server IP, Country, Hit Submit)
3) Reply to email
4) Download script to server using wget in /root directory

wget http://scriptmantra.info/scripts/AAST_ffmpeg_installer_5.0.7b
chmod +x AAST_ffmpeg_installer_5.0.7b
./AAST_ffmpeg_installer_5.0.7b

5) Select FFmpeg install. Setup will now run
6) Flawless install…FTW

nice…

This installer works well also ffmpeginstall.3.2.1.tar


wget https://g33kinfo.com/info/wp-content/uploads/2009/09/ffmpeginstall.3.2.1.tar.gz
tar -xzvf ffmpeginstall.3.2.1.tar.gz
cd ffmpeginstall.3.2.1
sh install.sh

Add SPF Records to all Domains

touch spf.sh

vim spf.sh

select and copy the following code (ctrl+A)

#!/usr/bin/python
import commands,os,time
curdate = time.strftime("%Y%m%d")
# Just in case things blow up
os.system("cp -Rp /var/named /var/named.backup")
os.chdir("/var/named")
files = commands.getoutput("ls *.db").split("\n")
for file in files:
domain = file.rstrip('db')
record = "\n%s IN TXT \"v=spf1 a mx ~all\"" %domain
f = open(file, 'a')
f.write(record)
f.close()
# Now we need to update the serial numbers
for file in files:
cmd = "sed -i -e \"s/[0-9]\{10\}/%s/\" %s" %(curdate, file)
os.system(cmd)
os.system("service named restart")
print "Done!"

hit insert on the keyboard

click inside the open file and paste above code then save the file.

:wq

modify it to run as an executable file

chmod 755 spf.sh

then run it…

./spf.sh