Skip to content

Monthly Archives: October 2009

RSYNC to backup your home DIR from your OLD server

31-Oct-09

RSYNC to backup your home DIR from your OLD server
#!/bin/bash
#admin@serversignature.com
rsync -vrplogDtH –exclude=virtfs/ –progress -e ssh root@192.168.0.1:/home/ home/
IF USING SSH Port = 2222
rsync -ave ’ssh -p 2222′ username@192.168.0.1:/home/ /home/

Quick rsync to backup your home dir and mysql databases

31-Oct-09

Quick rsync to backup your home dir and mysql databases.
#!/bin/bash
#RUN the below script using “nohup – run a command immune to hangups, with output to a non-tty”
#admin@serversignature.com
IP=192.168.0.1
rsync -vrplogDtH –exclude=virtfs/ –progress -e ssh root@$IP:/home/ /home/
rsync -vrplogDtH –progress -e ssh root@$IP:/var/lib/mysql/ /var/lib/mysql/
#Backup one large DB
rsync -vrplogDtH –progress -e ssh root@$IP:/var/lib/mysql/server_support /var/lib/mysql/
#END
OPTIONS SUMMARY
Here is a [...]

mail alert on root login

31-Oct-09

put in root user .bashrc file
echo ‘ALERT- Root Access on:’ `date` `who` | mail -s “Alert: Root Access from `who | cut -d”(” -f2 | cut -d”)” -f1`” admin@serversignature.com
or
echo ‘ALERT- Root Access on:’ `date` `who` | mail -s “Alert: Root Access from `who –i|grep root`” admin@serversignature.com

rsync backup to a central backup server

31-Oct-09

rsync backup to a central backup server with 7 day incremental
We can use – `date +%A-%D` in the script.
$ echo `date +%A-%D`
Saturday-10/31/09
#!/bin/sh
# This script does personal backups to a rsync backup server. You will end up
# with a 7 day rotating incremental backup. The incrementals will go
# into subdirectories named after the day of the [...]

How to check DMA mode on SATA

31-Oct-09

How to check DMA mode on SATA
dmesg |grep DMA
$ sudo dmesg |grep DMA
[ 0.000000] DMA 0×00000010 -> 0×00001000
[ 0.000000] DMA zone: 32 pages used for memmap
[ 0.000000] DMA zone: 0 pages reserved
[ [...]

hdparm get/set SATA/ATA device parameters

31-Oct-09

hdparm – get/set SATA/ATA device parameters
Hdparm is a tool that allows you to set IDE device settings. This includes things such as DMA modes, transfer settings and various other settings that can help improve the speed of your hard disks and CDROMs. These settings are not enabled by default, so [...]

OpenVZ Operating system-level virtualization

31-Oct-09

Installing OpenVZ
OpenVZ is operating system-level virtualization based on a modified Linux kernel that allows a physical server to run multiple isolated instances known as containers, virtual private servers (VPS), or virtual environments (VE).
Installing OpenVZ on a CentOS 4 or CentOS 5
Download – http://download.openvz.org/openvz.repo
Import the OpenVZ key
rpm –import http://download.openvz.org/RPM-GPG-Key-OpenVZ
Install the OpenVZ kernel
Depending on which kernel arch [...]

Optimizing the EXT3 file system on Linux

31-Oct-09

Optimizing the EXT3 file system on Linux
There are some things you can do to give ext3 a boost when you just want speed.
Mount Options noatime,nodiratime
noatime
Do not update inode access times on this file system (e.g, for faster access on the news spool to speed up news servers).
nodiratime
Do not update directory inode access times on this [...]

Create a mysql database and User

31-Oct-09

Create a mysql database and User
mysql> CREATE DATABASE database1;
For creating a new user with all privileges (use only for troubleshooting), at mysql prompt type:
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘yourusername’@'localhost’ IDENTIFIED BY ‘yourpassword’ WITH GRANT OPTION;
For creating a new user with fewer privileges (should work for most web applications) which can only use the [...]

Set mysql root password

31-Oct-09

Set mysql root password
Before accessing the database by console you need to type:
mysql -u root
At the mysql console type:
mysql> SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(’yourpassword’);