Linux Happyness
Server overload warning
by z3n on Dec.27, 2011, under Linux Happyness, Tips & Hints
Problem:
So i have this shitty server that keeps overloading, although i have all sort of monitors around, many screens, etc I really can’t keep looking at the graphs all day long, but yet i’m almost of the time on the computer.
So why not have a sound trigger when server load go over 10?
Solution:
This php script solves it:
// (c) z3n - R1V1@111227 - www.overflow.biz - rodrigo.orph@gmail.com
while (true) {
$output = explode(" ", trim(substr(strstr(exec("uptime"), "load average:"), 13)));
if (substr($output[0], 0, -1) > 10)
@ passthru("echo -e -n \\\\a");
echo "\r[" . date("Y-m-d H:i:s") . "] " . implode(" ", $output);
sleep(5);
}
Facebook auto poker
by z3n on Dec.27, 2011, under Linux Happyness, Tips & Hints
I wrote this macro with XTE intended to run on linux on a VNC screen, nothing a regular geek wouldn’t understand.
Never loose a poke war ever again:
while [ 1 ] ; do xte 'mousemove 20 350' 'mouseclick 1';sleep 5;xte 'mousemove 300 235' 'mouseclick 1';sleep 30;done;
FTP not working?
by z3n on May.24, 2011, under Linux Happyness
Problem:
FTPd is working however when you try to login you get access denied on user’s home folder, no matter what accesses and group/user combination.
Solution:
Check /var/log/audit/autit.log and /var/log/messages
This usually is a SELinux block, fix it using:
setsebool -P ftp_home_dir=1
Change sendmail’s outgoing ip
by admin on Apr.16, 2011, under Linux Happyness
Problem:
How to change sendmail’s outgoing ip?
Solution:
This is the ip that will be used to deliver messages, this ip might get blacklisted if one of your happy clients on a shared server decides to send a mass email.
Sendmail is always a bitch to config, but this time it wasn’t, just change your .m4 file adding:
CLIENT_OPTIONS(`Addr=123.456.789')dnl
rebuild the .cf file, restart sendmail and you’re done. In my case, I had a specific ip on the server that got “temporary” (permanently) blocked by gmail. Although new mail wasn’t being sent after the flood, google never unblocked my server, even after a week i still getting “limit rate exceeded” messages. Since I have many IPs on the server it was easier just to bind sendmail to another IP.
Source:
Finding big files on linux
by z3n on Apr.02, 2011, under Linux Happyness
Problem:
How to find big files on linux?
Solution:
find / -type f -size +50000k
This will find files bigger than 50MB (50000k)
rsync over ssh with custom port
by z3n on Oct.29, 2010, under Linux Happyness
Problem:
How to do a rsync with custom ssh port ?
Solution:
This was a bit hard to find, so i’m posting it.
add:
-e “ssh -p PORT_NUMBER -C -oCompressionLevel=9″
to the command, like this:
rsync -azv --bwlimit=400 -e "ssh -p 12345 -C -oCompressionLevel=9" YOUR_HAPPY_USER@YOUR_SERVER:/path/to/files/from/server /path/to/local
Source:
Disable local email delivery on hosted domains
by z3n on Sep.04, 2010, under Linux Happyness
Problem:
There’s some domains on a server that users a external server to process the emails (eg. google servers, aspmx.l.google.com) those emails are all fine when sent from outside the box but when sent from the box they fail to reach the destination or get delivered to a local user.
Solution:
define(`MAIL_HUB', `example.com.')dnl define(`LOCAL_RELAY', `example.com.')dnl
For sendmail, this will make the domain’s emails to be delivered to the ip address assigned at the domain’s MX record.
Note:
This seemed promising for me at first look, but it will redirect ALL local domains to this MX record, ruining everything. Nothing new when dealing with sendmail, anyway when i find a better solution for this i will update this post again.
Source:
How to find disk UUID
by z3n on Jul.05, 2010, under Linux Happyness, Tips & Hints
Problem:
I wanted to change the default mounts at /etc/fstab, but i couldn’t find the disks UUID.
Solution:
blkid /dev/DEVNAME
How to figure out how many sectors a disk has on linux
by z3n on Jul.05, 2010, under Linux Happyness
Problem:
How to find out the absolute count of sectors on a disk at linux?
Solution:
hdparm /dev/YOURDEV
How to clone a disk on linux
by z3n on Jul.05, 2010, under Linux Happyness
Problem:
How to do a 1:1 copy of a disk on linux?
Solution:
dd bs=4k if=/dev/SOURCE of=/dev/DESTINATION conv=noerror,sync
This will make a 1:1 copy directly into the destination device, you should be aware that both devices should have the same size, so make sure you know which one is the source and destination in order to avoid catastrophic fail.
For your enjoyment, you can also make a iso image:
dd if=/dev/SOURCE of=/path/to/image.iso
Source: