November 29th, 2011 |
admin |
You need to setup password less login using ssh keys; refer to following tutorials: + Howto Linux / UNIX setup SSH with DSA public key authentication (password less login) + SSH Public key based authentication – Howto #!/bin/bash # Remote Server Rsync backup Replication Shell Script # ————————————————————————- # Copyright (c) 2005 nixCraft project # [...]
November 28th, 2011 |
admin |
Use echo command to display text or value of variable. echo [options] [string, variables...] Displays text or variables value on screen. Options -n Do not output the trailing new line. -e Enable interpretation of the following backslash escaped characters in the strings: \a alert (bell) \b backspace \c suppress trailing new line \n new line [...]
November 28th, 2011 |
admin |
script to move the datadirectory of mysql #!/bin/bash #/***********************************************************************/ #/***This is the script for changing the data directory of mysql**********/ #/***********************************************************************/ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 [...]
November 28th, 2011 |
admin |
1.Introduction. Scripting Languages for Linux There are numerous scripting languages for Linux, four of them are: Bash Perl PHP Python Having chosen which language to use it’s then essential that the script user should need to know further about it. Shell scripting means: Unix/Linux users are able to call a scripting program from the command [...]
November 28th, 2011 |
admin |
mcelog: Shell Script To Send Email Alert When Hardware Errors Detected #!/bin/bash # Linux 64 bit kernel shell script to collect hardware errors via /var/log/mcelog # and send email alert. # ————————————————————————- # Copyright (c) 2008 nixCraft project <http://cyberciti.biz/fb/> # This script is licensed under GNU GPL version 2.0 or above # ————————————————————————- # This [...]
November 28th, 2011 |
admin |
netstat -plan|grep :80|awk {’print $5′}|cut -d: -f 1|sort|uniq -c|sort -nk 1 or netstat -pan | sort +4 | grep TIME_WAIT | awk ‘{print $5}’ | sed -e s/’:.*’//g | sort | uniq -c | sort -k 1 -nr | head -n 20 Incoming search terms:centos number connections (2)
November 28th, 2011 |
admin |
for i in `ps ax | grep D | awk {’print $1′}`;do kill -9 $(cat /proc/${i}/status | grep PPid | awk {’print $2′});done Incoming search terms:centos dead processes (1)directadmin kill process (1)kill dead process (1)kill dead process advanced (1)linux kill dead processes (1)
November 28th, 2011 |
admin |
netstat -an |grep 80 netstat -plan|grep :80|awk {’print $5′}|cut -d: -f 1|sort|uniq -c|sort -nk 1 netstat -plan|grep :25|awk {’print $5′}|cut -d: -f 1|sort|uniq -c|sort -nk 1 watch -n 5 ‘w; ls -alS /usr/local/apache/domlogs/ ‘ Incoming search terms:centos ddos (3)ddos centos (2)apache detect ddos (1)locate ddos file in linux (1)linux find * -name (1)how to detect [...]
November 28th, 2011 |
admin |
this script to help install ruby on rails cd /usr/src wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5.tar.gz tar -xzvf ruby-1.8.5.tar.gz cd ruby-1.8.5/ ./configure make make test make install cd /usr/src wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz tar -zxvf rubygems-0.8.11.tgz cd rubygems-0.8.11 ruby setup.rb gem update gem install rails –include-dependencies rails /usr/local/rails mv /usr/local/rails/public/.htaccess /usr/local/rails/public/.htaccessfile echo “RewriteBase /rails” > /usr/local/rails/public/.htaccess cat /usr/local/rails/public/.htaccessfile >> /usr/local/rails/public/.htaccess mv /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conffile [...]
November 28th, 2011 |
admin |
========================= Resore pkg cat /root/finallist | awk -F. ‘{print $1}’ > /root/list0 for i in `cat /root/list0`;do /scripts/restorepkg $i;done ========================= to copy the dailybackups for a list of users to a user home from server backup #!/bin/bash for i in `cat /root/thewebcousers`; do cp -rp /backup/cpbackup/daily/$i.tar.gz /home/thewebco chown thewebco.thewebco /home/thewebco/$i.tar.gz done ========================= #!/bin/bash for i [...]