Month: March 2009

How do I capture the output of “top” to a file?

This will run top once write the output to a file and exit. The command top can also be run so that it will give multiple reports. top -b -n1 > /tmp/top.txt To run top 5 times and wait 5 seconds between each output the command would be: top -b -n5 -d5 > /tmp/top.txt


FFMpeg Install

1) Install ffmpeg via admin-ahead.com (http://scriptmantra.info/ffmpeg.html) 2) Register here: http://installers.admin-ahead.com/ (Name, Email, Server IP, Country, Hit Submit) 3) Reply to email 4) Download script to server using wget in /root directory wget http://scriptmantra.info/scripts/AAST_ffmpeg_installer_5.0.7b chmod +x AAST_ffmpeg_installer_5.0.7b ./AAST_ffmpeg_installer_5.0.7b 5) Select FFmpeg install. Setup will now run 6) Flawless install…FTW nice… This installer works well also ffmpeginstall.3.2.1.tar…


Add SPF Records to all Domains

touch spf.sh vim spf.sh select and copy the following code (ctrl+A) #!/usr/bin/python import commands,os,time curdate = time.strftime(“%Y%m%d”) # Just in case things blow up os.system(“cp -Rp /var/named /var/named.backup”) os.chdir(“/var/named”) files = commands.getoutput(“ls *.db”).split(“\n”) for file in files: domain = file.rstrip(‘db’) record = “\n%s IN TXT \”v=spf1 a mx ~all\”” %domain f = open(file, ‘a’) f.write(record)…


Kick all users other than you from your box and keep them out.

watch -d ‘w | awk ‘NR==4 {print “/dev/”$2}’ | xargs fuser -k’


Reboot Linux Gracefully When Hung

alt + print screen/sys rq + R – S – E – I – U – B


Watch a Process

Watch will run the specified command repeatedly (by default, every two seconds) and display the output so you can watch it change over time. watch -d -n 15 ps auxf | grep cpbackup -d differences -n 15 =#seconds


Installing cfs & bfd

CSF and LFD are very easy to install and to configure especially if you are using a cpanel & WHM server. Here are the instructions on how to install CSF and LFD. 1) SSH into your server and switch to the root user 2) Switch directories to your download directory, usually /root cd ~ 3)…


Install htop from source

Htop is an interactive process viewer for Linux. It is a text-mode application (for console or X terminals) and requires ncurses. Tested with Linux 2.4 and 2.6. wget http://downloads.sourceforge.net/htop/htop-0.8.1.tar.gz?use_mirror=superb-east tar -xzvf htop-0.8.1.tar.gz cd htop-0.8.1 ./configure make make install —————————————– Install via YUM: I added the following to dag.repo in /etc/yum.repos.d [dag] name=Dag RPM Repository for…