Jul 19 2010
How to DISABLE ipv6 in CentOS5 System
# ifconfig
eth1 Link encap:Ethernet HWaddr 00:1C:F0:BB:A7:28
inet addr:10.10.10.11 Bcast:10.10.10.255 Mask:255.255.255.0
inet6 addr: fe80::21c:f0ff:febb:a728/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:470449435 errors:1 dropped:0 overruns:0 frame:0
TX packets:464084402 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2563674692 (2.3 GiB) TX bytes:2243518951 (2.0 GiB)
Interrupt:225 Base address:0×2800
Jul 11 2010
Scripting a MySQL InnoDB Engine Conversion
0) Backup your database.
You should probably be doing this already. Now’s a good time to make sure that your backups ran.
1) Create the script.
You’ll need the correct permissions to query the database. Here’s the command. Be sure to change <DATABASE_NAME> as it fits.
# mysql -p -e "show tables in <DATABASE_NAME>;" | \
tail --lines=+2 | \
xargs -i echo "ALTER TABLE {} ENGINE=INNODB;" > alter_table.sql
2) Run the script.
# mysql --database=<DATABASE_NAME> -p < alter_table.sql
3) Verify it by running this command in mysql:
mysql> show table status;
/usr/local/bin/mysql.backup.sh
#!/bin/bash NOW=$(date +"%m-%d-%Y") OLD=$(date +"%m-%d-%Y" --date="3 days ago") PROJECT="project_name" LOCATION="/home/backup" FILE="$PROJECT.$NOW.sql" FILE2="$FILE.gz" FILEOLD="$PROJECT.$OLD.sql.gz" EMAIL="youremail@domain.com" $SQLUSER="username" $SQLPASS="password" $SQLNAME="database_name"cd $LOCATION ; \ rm -f $FILEOLD ; \ mysqldump -u $SQLUSER --password=$SQLPASS $SQLNAME > \ $LOCATION/$FILE ; \ gzip $LOCATION/$FILE ; \ echo "Backup location is in $LOCATION/$FILE2" | \ mail -s "[$PROJECT] MySQL Backup" $EMAIL
Then you can put it on your cron (background process)
Below cron will execute the script on Saturday at 12AM:
0 0 * * 6 /usr/local/bin/mysql.backup.sh
Good luck!