Archive

Archive for August, 2010

Solved:mod_fcgid: /var/www/virtual/domain.tld/htdocs/index.php total process count 8 >= 8, skip the spawn request:ispcp

August 31st, 2010 No comments

mod_fcgid: /var/www/virtual/linksoflondonuk.com/htdocs/index.php total process count 8 >= 8, skip the spawn request
Method to solve:
vim /etc/apache2/mods-available/fcgid_ispcp.conf,and 33gg to line 33,modify MaxProcessCount 8 to a larger value:like,MaxProcessCount 10.

Categories: IT Architecture, Linux Tags:

Bash Reference Manual download,pdf and html format

August 30th, 2010 2 comments

60,878 words.Very detailed and useful for you to learn bash shell scripting.Digest it!
wc -w <<<`man bash`
bash.htm(right click and save it)
bash.pdf(right click and save it)

linux bash shell auto switch lowercase-uppercase

August 29th, 2010 No comments

Functionality:

Switch lowercase-uppercase from files given in parameters:
#if.sh -u aaa.txt bbb.txt #aaa.txt.UC bbb.txt.UC=>UPPERCASE
#if.sh -l aaa.txt bbb.txt #aaa.txt.LC bbb.txt.LC=>lowercase
Here goes the script: Read more…

rpm(centos),apt-get(debian) auto detect and uninstall packages(bash shell)

August 27th, 2010 No comments

Here goes the thinking:First,use rpm -qa or apt-cache policy to find the name of the package(s) to remove.Then,use rpm -e or apt-get remove to uninstall the packages.
Detect the os type by bash shell:http://www.doxer.org/learn-linux/linux-shell-centos-debian-ostype/
#centos begin
rpm -qa|grep httpd #under centos it’s httpd,debian apache
if [ $? = '0' ];then
aa=”`rpm -qa|grep httpd`” #get the full-name of the package
rpm -e $aa
fi

#debian begin
apt-cache policy apache2|grep “Installed: 2.” -q
if [ #? = '0'];then
apt-get remove apache2
fi

Add user account in proftpd server(Privileges through setfacl &getfacl)

August 27th, 2010 No comments

After you’ve installed proftpd in centos or debian,add user account is the next step.Use groupadd and useradd command,and passwd to set a password,the new user is then ready to use ftp to log in the home directory(set home directory by ‘useradd -d’).
But sometimes,things are not that simple.Now you want the ftp user have specified privileges on some directories,and you are not allowed to change the old mod(for example,directories under /var/www/htdocs).If you encounter this,time for you to use acl(Access Control List) module of linux.
Here is the detailed steps:
groupadd test
useradd -g test -d /var/www/virtual -s /sbin/nologin test #-s /sbin/nologin disallow user to log in the system
passwd test
setfacl -m u:test:rwx /var/www/virtual #test now have mod rwx
getfacl /var/www/virtual

#In /etc/rc.local,type in setfacl -m u:test:rwx /var/www/virtual to run the command at boot time

#If you find no command setfacl,getfacl on your system,use yum install acl(centos),apt-get install acl(debian,ubuntu) to firstly install them.

Categories: IT Architecture Tags: , ,

Auto backup mysql database and use ftp command to cron transfer(bash shell)

August 27th, 2010 No comments

Use mysqldump command to dump the database sql files,then merge it with site file sources to tar named suffixed by YYYYMMDD(year-month-day).Then use ftp protocal tranfering the tarball to your remote backup server.
Here goes the script:
#!/bin/bash
#wordpress_backup.sh,chmod +x wordpress_backup.sh
YYYY=`date +%Y`
MM=`date +%m`
DD=`date +%d`
filename=”$YYYY$MM$DD”
mysqldump -h localhost -u root -p123456 –default-character-set=utf8 db1>/tmp/db1_${filename}.sql
mysqldump -h localhost -u root -p123456 –default-character-set=utf8 db2>/tmp/db2_${filename}.sql
tar zcvpPf /tmp/doxer_$filename.tar.gz /var/www/virtual/doxer.org /tmp/db1_${filename}.sql db2_${filename}.sql
# to your backup server
ftp -v -n xxx.xxx.xxx.xxx <<EOF
userĀ  [email protected] password
binary
cd backup_sql #change directory on remote backup server
lcd /tmp #change directory on localhost
prompt
mput doxer_$filename.tar.gz #upload tarball
close
bye
EOF

At last,if you want to backup the files three times a week,use crond to accomplish it.Here is the usage: Read more…