Category: sysadmin
-
alias with argument in bash shell
Instead of running “ssh -p 1234 -l shelluser serverX.example.com”, you could do “myssh serverX”. To do that, you can put this into your .bash_profile as an alias: sshas() { ssh -p 1234 -l shelluser “$1”.example.com; }
-
2 tips – Check PHP syntax and SVN move multiple files
This is what I have in my .bash_profile. It check for all the PHP files, recursively, for any syntax error. alias php_check_syntax=’find . -type f -name \*.php -exec php -l {} \;’ This other tip is to move multiple files in SVN. You can make it a script if you want. for i in *.test.php…
-
XAMPP vs. doing it your own
Thinking that I would have more control by setting up the packages by myself, I was wrong. After running into the problem with pre-installed PHP by MacOS X Leopard does not have GD, IMAP and other components, I tried playing with fink, MacPorts and manual compiling. LAMP still rules and not “MAMP” for good reasons.…
-
Adding a second hard drive under Linux/CentOS
Check out the new new drive In this example, you will see I have 2x500GB drives, sda and sdb. sda already in used and sdb is new. [root@s3 mathie]# fdisk -l Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot…
-
Getting lighttpd RPM
There are many places you can download the latest lighttpd RPMs: Primary: http://packages.sw.be/lighttpd/ http://dag.wieers.com/rpm/packages/lighttpd/ Secondary: EL4: http://ftp.freshrpms.net/pub/freshrpms/redhat/testing/EL4/lighttpd/ EL5: http://www.kevindustries.com/media/kw/files/linux/lighttpd/RPMS/EL5/ EL5 x86_64: http://linuxwave.blogspot.com/2007/08/installing-lighttpd-in-centos-5-for.html 1.4.17: http://www.kevindustries.com/media/kw/files/linux/lighttpd/RPMS/
-
Stress test a new server
Got a new server and want to stress test its CPU & disk? Run Folding@Home or other computing service and also BitTorrent (download some Linux distros like Fedora, CentOS). Testing and yet help the community. Folding @ Home wget http://www.stanford.edu/group/pandegroup/folding/release/FAH6.02-Linux.tgz tar -zxf FAH6.02-Linux.tgz ./fah6 –config echo “./fah6 -smp -verbosity 9 $* &” > fah chmod…
-
How to automatically reboot after a kernel panic?
You should investigate the root cause when possible but if the machine needs to be up and running again without much interruption, you can have it reboot when panicking after a number of seconds. Put this into /etc/sysctl.conf kernel.panic = 60
-
pecl and memory limit error
If you run “pecl install [something]” and get this error: “Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate xxx bytes)”, you want to change “/usr/bin/pecl” (or run “locate pecl” to see where it is) and specify a larger memory limit. #!/bin/sh exec /usr/bin/php -C -n -q -d include_path=/usr/share/pear \ -d output_buffering=1…
-
ip_conntrack and dropped packets
For busy servers, ip_conntrack can fill up quickly and must be monitored or you will get intermittent packet drops. Check var/log/messages for these error messages. Couple values can be adjusted to the kernel: more /proc/sys/net/ipv4/netfilter/ip_conntrack_count more /proc/sys/net/ipv4/netfilter/ip_conntrack_max => count should be less than max, if it’s near the maximum value, increase max more /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established =>…
-
mod_deflate bug
Hmm, another day, another bug: #33499. This time it is mod_deflate and PHP don’t play well together. PHP makes a GIF/JPG file and yet mod_deflate still compress it. Solution: use mod_filter (which only available from 2.1), or disable Apache’s compression for PHP files and let PHP do the compression via ob_start(‘ob_gzhandler’);