shell scripts

You are currently browsing the archive for the shell scripts category.

Go to the root of your webserver and type

svn co http://svn.automattic.com/wordpress/trunk/ .

You need to have svn installed - if not yet done the following command should do this for you.

aptitude install subversion

If you want to update your Wordpress plugins remotely through your linux server, you have to install them through SVN. Go to your plugin-in folder (ususally: ../wp-content/plugins/) and type

svn propedit svn:externals .

(Please note that the period at the end is important).

Your editor of choice should now open and you have to integrate your wished plugins. Find below one example:

akismet http://plugins.svn.wordpress.org/akismet/trunk/
flickr-slideshow-wrapper http://plugins.svn.wordpress.org/flickr-slideshow-wrapper/trunk
sociable http://plugins.svn.wordpress.org/sociable/trunk/
google_sm http://plugins.svn.wordpress.org/google-sitemap-generator/trunk/
lightbox-2 http://plugins.svn.wordpress.org/lightbox-2/trunk/
wp-security-scan http://plugins.svn.wordpress.org/wp-security-scan/trunk/
snapshot http://plugins.svn.wordpress.org/snap-shots-for-wordpressorg/trunk/
syntaxhighlighter-plus http://plugins.svn.wordpress.org/syntaxhighlighter-plus/trunk/
twitter-tools http://plugins.svn.wordpress.org/twitter-tools/trunk/

Please not that I’m using here the ‘trunk’-version, which are the latest development and might contain bugs. You can alternatively specify /tags/XYZ/ - XYZ being the release version you want to install.

After having saved your new entry you have to go back to your root folder (e.g. by cd ../..) and then please type:

svn up

The system will now download the latest version(s) and you only have to (re-)activate your plugins within Wordpress.

A regular updating with ’svn up’ will keep your plugins updated.

  • Digg
  • del.icio.us
  • Google
  • MisterWong
  • Technorati
  • Mixx
  • Propeller
Sphere: Related Content

It doesn’t matter what you’re running as CMS, forum or blog. Most software solutions are based on an Apache2 Server and a mySQL database. But only a few people are aware of appropriate backup solutions.

I hope below script will help people, who are not yet familar with rootserver, and are used to reinstall their systems (guess why I do know this ). Below two scripts will help you on creating a backup for your mySQL database and creating a dump of your whole web presentation files.

Below script will do the necessary BACKUP for you:

#!/bin/bash
# BACKUP SCRIPT FOR ROOTSERVERS
#
# ASSUMPTIONS:
# data stored in a mysql database (dumping and taring DB)
# webfiles (taring all webfiles)
#
# save this script e.g. web_backup.sh
# don't forget to chmod 700 web_backup.sh
# execute script via ./web_backup.sh
#
#
# DO NOT STORE FILES IN WEB ROOT FOR SECURITY PURPOSES!
#
# THIS SCRIPT IS OPENSOURCE
#
# written by Jeannot Muller
#
# mailto:jeannot.muller@ramgad.com:
# http://www.ramgad.com
#
#
# Version 2.1 (23th March 2008)

# DATADECLARATION
HOSTNAME=localhost
DB_NAME='db_name'
DB_USER='db_user'
DB_PASSWORD='db_password'
BACKUP_PATH_DB='xxx'
BACKUP_PATH_WB='yyy'
BACKUP_NAME_DB='database'
BACKUP_NAME_WB='webroot'
WEB_ROOT_PATH='/var/www/'
FTP_DEST='backup999.onlinehome-server.info'
FTP_USER='ftp_user'
FTP_PWRD='ftp_pwrd'
FTP_PATH_DB='/db_backup/'
FTP_PATH_WB='/wb_backup/'

# BUILDING TIMESTAMP FOR ALL FILES
TIME_STAMP=`date +%m-%d-%Y-%Hh%M`

# DATA CLEANSING
# (delete all files older than 20 days)
find $BACKUP_PATH_DB -name "*.tar.gz" -mtime +20 -exec rm -f {} \;
find $BACKUP_PATH_WB -name "*.tar.gz" -mtime +20 -exec rm -f {} \;

# EXECUTING DUMP FROM MYSQL
cd $BACKUP_PATH_DB
mysqldump --opt -c -e -Q -h$HOSTNAME -u$DB_USER -p$DB_PASSWORD $DB_NAME > $BACKUP_NAME_DB.sql

# COMPRESSING: DUMP AND ADDING TIMESTAMP
tar czpf $BACKUP_PATH_DB/$BACKUP_NAME_DB.$TIME_STAMP.tar.gz $BACKUP_NAME_DB.sql

# MOVING TO WEB_ROOT
cd $WEB_ROOT_PATH

# COMPRESSING ALL WEBROOT FILES (and copy latest version)
tar czpf $BACKUP_PATH_WB/$BACKUP_NAME_WB.$TIME_STAMP.tar.gz *
cp $BACKUP_PATH_WB/$BACKUP_NAME_WB.$TIME_STAMP.tar.gz $BACKUP_PATH_WB/$BACKUP_NAME_WB.tar.gz

# BACKUP TO EXTERNAL SERVER
ftp -n $FTP_DEST <<SCRIPT
quote USER $FTP_USER
quote PASS $FTP_PWRD
binary
put $BACKUP_PATH_DB/$BACKUP_NAME_DB.$TIME_STAMP.tar.gz $FTP_PATH_DB/$BACKUP_NAME_DB.$TIME_STAMP.tar.gz
put $BACKUP_PATH_WB/$BACKUP_NAME_WB.$TIME_STAMP.tar.gz $FTP_PATH_WB/$BACKUP_NAME_WB.$TIME_STAMP.tar.gz
quit
SCRIPT
exit 0

Below script will do the necessary RESTORE for you:

#!/bin/bash

# RESTORE SCRIPT FOR ROOTSERVERS
#
# ASSUMPTIONS:
# correct Datadeclaration
#
# save this script e.g. web_restore.sh
# don't forget to chmod 700 web_restore.sh
# execute script via ./web_restore.sh
#
#
# DO NOT STORE FILES IN WEB ROOT FOR SECURITY PURPOSES!
#
# THIS SCRIPT IS OPENSOURCE
#
# written by Jeannot Muller
#
# mailto:jeannot.muller@ramgad.com
# http://www.ramgad.com
#
#
# Version 2.1 (23th March 2008)

# DATADECLARATION
HOSTNAME=localhost
DB_NAME='db_name'
DB_USER='db_user'
DB_PASSWORD='db_password'
BACKUP_PATH_DB='xxx'
BACKUP_PATH_WB='yyy'
BACKUP_NAME_DB='database'
BACKUP_NAME_WB='webroot'
WEB_ROOT_PATH='/var/www/'

# CLEANSING WEBROOT
cd $WEB_ROOT_PATH
rm -R *

# COPYING BACKUP INTO ROOT
cp $BACKUP_PATH_WB/$BACKUP_NAME_WB.tar.gz $WEB_ROOT_PATH

# DECOMPRESSING FILES
tar xfvz $WEB_ROOT_PATH/$BACKUP_NAME_WB.tar.gz

# DELETING SOURCE IN ROOT
rm $WEB_ROOT_PATH/$BACKUP_NAME_WB.tar.gz

# RESTORE DATABASE
mysql -h$HOSTNAME -u$DB_USER -p$DB_PASSWORD $DB_NAME < $BACKUP_PATH_DB/$BACKUP_NAME_DB.sql
  • Digg
  • del.icio.us
  • Google
  • MisterWong
  • Technorati
  • Mixx
  • Propeller
Sphere: Related Content

Tags: , , , ,

© 1995-2009 Dr. med. Jeannot Muller (Europe)