August 21, 2013, 2:31 pm
Ever want to know who has what imap-login ? Then run something along these lines
for i in $(ps -ef | awk '/[i]map$/ {print $2}'); do
echo "$(lsof -p $i | awk '/cwd/ {print $9}') is handled by process id $i" ;
done
Which returns something along these lines (names changed to protect the innocent ;) .
$PATHTOVPOPMAIL/domains/$DOMAIN/$USER is handled by process id 1277
Just a quick lunch time hack that might help some errant google searcher.
August 11, 2013, 12:49 am
This is a easy one to fix you just have to open:
/etc/grub.conf
and find
nomodeset
remove it,then move your xorg.conf (if you made one trying to fix this mess) outta the way, then reboot.
July 31, 2013, 8:32 pm
Well thought I would drop in and writeup a quick fix to a minor annoyance with the IUS (and other 5.4 versions of php) and that is the STRICT and Deprecated warnings in logs. It appears that the new version of this is a bit more “open” on what it takes to turn this on (ie code in sites like phpbb, wordpress, and others) and the error_reporting setting in php.ini didnt make it quiet. Lucky for me this quick hack did:
emacs /etc/httpd/conf.d/php.conf
<IfModule prefork.c>
LoadModule php5_module modules/libphp5.so
php_admin_value error_reporting ” E_ALL & ~E_DEPRECATED & ~E_STRICT”
</IfModule>
Global override saves the day. Now I can go back to sed-ing out all this cruft this update to 5.4IUS on RHEL 6 just did to my logs! I will say that the mysqlnd that comes with 5.4 is quite impressive…look for a writeup sometime soon.
April 18, 2013, 8:42 am
Here is a real error I got after making a system config change recently. Can anyone guess what that change might have been. To give a little hint I got this on a new session opened up in screen on the system that had the change.
[I have no name!@*****]>ssh ******
You don’t exist, go away!
April 12, 2013, 6:23 am
NOTE: This is not working totally with USB3 interfaced drives. Likely a update to the tools will fix this.
The following command:
smartctl -i /dev/sdb
Where hdparm /sdparm (and lsusb -v) show you info about the USB device this gives you the info about the device IN the USB enclosure.
Here is output:
=== START OF INFORMATION SECTION ===
Model Family: Seagate Barracuda XT
Device Model: ST33000651AS
Serial Number: 9XK0AKRX
LU WWN Device Id: 5 000c50 02d957ba3
Firmware Version: CC43
User Capacity: 3,000,592,982,016 bytes [3.00 TB]
Sector Size: 512 bytes logical/physical
Device is: In smartctl database [for details use: -P show]
ATA Version is: 8
ATA Standard is: ATA-8-ACS revision 4
Local Time is: Fri Apr 12 08:17:27 2013 EDT
SMART support is: Available – device has SMART capability.
SMART support is: Enabled
March 5, 2013, 3:25 pm
The quick and dirty way:
- Download SRC rpm for kernel you want to build module for
- Run `rpmbuild -bp kernel.spec`. While the magic is happening here go `make pbnj` or read the latest copy of 2600…oh wait thats not printed any more..crap.
- Next go to your your kernel build directory `cd /root/rpmbuild/BUILD/kernel-$(uname -r | sed ‘s/.x86_64//’)/linux-$(uname -r)`
- type `make menuconfig`
- Go to “Device Drivers | Block devices” and set “M” on “Network block device support” exit saving new kernel config.
- Next type `make prepare && make modules_prepare && make` (make is needed otherwise you are missing symbols that the nbd.ko needs)
- If your system is older, now is the time to take your significant other to dinner, catch up on some online gaming, or play with your kids.
- Next we build just the block device modules by typing`make M=drivers/block`
- We now check the module ` modinfo drivers/block/nbd.ko` if all looks good we copy it to the running kernels extra folder in /lib/modules/$(uname -r)/extra.
- We can finally now load the module via `depmod -a && modprobe nbd`.
I will be doing some testing on NBD vs GlusterFS in a coming post. The one kicker is that the NBD and GlusterFS servers will be running on a RazPi’s with a 2G USB thumbdrive for the exported block device (thanks to the vendors at conferences!) .
September 26, 2012, 10:06 am
Below is a quick hack I did that I thought folks might find useful. I used it to watch the CPU temps of a system in a VERY warm room. More a exercise but someone might find it useful :)
#!/bin/sh
EMAIL=YOUREMAILHERE
SENSOR=coretemp-isa-0000
MAXTEMP=50
MESSAGE=/dev/null
HOSTNAME=$(hostname)
for t in $(sensors -u $SENSOR | grep input | awk -F: ‘{printf “% .0f”, $2}’); do
if [ $t -gt $MAXTEMP ] ;
then mail -s “$(echo “CPU in $HOSTNAME at “$t”C”)” $EMAIL < $MESSAGE;
fi;
done
May 15, 2012, 12:47 pm
Unless the archive is totally foobar one way is to use this quick command
pax -v -r * < /path/to/archive
This will restore your archive to the paths in the archive (ie /home/user will be restored to that path) if you need different options man pax is your new friend.
December 14, 2011, 12:43 pm
I am going to start a new section of Linux CLI foo that you may or may not know about. Many of these will be faster ways of doing things or getting information in a slightly different fashion. Many are old favorites of mine that I just wanted to share in case they help someone else.
Now without further ado the first command is :
ip -s l
short for ip stats list this gives a fast overview of your interfaces and the types of packets that have been going through them. Output looks like this :
[root@pbnj lisa11]# ip -s l
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
RX: bytes packets errors dropped overrun mcast
1084866683 400954 0 0 0 0
TX: bytes packets errors dropped carrier collsns
1084866683 400954 0 0 0 0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:30:48:61:c7:64 brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
552827144 1541759 0 0 0 0
TX: bytes packets errors dropped carrier collsns
1428902993 1445402 0 0 0 0
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
link/ether 00:30:48:61:c7:65 brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0
More information on interface stats can be found via:
ethtool -S $DEVICE
ifconfig $device (or just ifconfig for all devices)
ifconfig -s $DEVICE
among others….
October 18, 2011, 1:36 pm
If you are running tuned these settings will likely “undo” themselves. I found this out the hardway ;)
Update: If you are running a old firmware (older than CC34) update !! More on the update are on Seagates page and here http://niallbest.com/seagate-2tb-st32000542as-cc35-firmware-upgrade/. To find your firmware use `hdparm -I /dev/sd[a-z] | grep Firmware`.
I was noticing Samba being slow when I would access it from time to time. It would always work but man was it annoying. Since this was right after I added some new 2TB drives to my LVM/Software Raid 1 array I figured I would check to see if power management had been the cause for my pain. Sure enough I found this :
[root@stardust ~]# hdparm -C /dev/sd[a-z] | sed ‘/^$/d’
/dev/sda:
drive state is: active/idle
/dev/sdb:
drive state is: standby
/dev/sdc:
drive state is: active/idle
/dev/sdd:
drive state is: active/idle
/dev/sde:
drive state is: standby
/dev/sdf:
drive state is: active/idle
/dev/sdg:
drive state is: active/idle
To which I answered with :
hdparm -B 255 -S 0 -K 1 /dev/sd[b,e]
and wala all was happy again and my delay was gone!
/dev/sda:
drive state is: active/idle
/dev/sdb:
drive state is: active/idle
/dev/sdc:
drive state is: active/idle
/dev/sdd:
drive state is: active/idle
/dev/sde:
drive state is: active/idle
/dev/sdf:
drive state is: active/idle
/dev/sdg:
drive state is: active/idle
The new drives were Seagate “Green” drives (ST32000542AS) so I cant blame them for shipping with aggressive power save settings. If you need to check what your power save settings are you can do something like :
for d in /dev/sd[a-z]; do echo $d; hdparm -I $d | grep level; done
/dev/sda
/dev/sdb
Advanced power management level: disabled
/dev/sdc
/dev/sdd
/dev/sde
Advanced power management level: disabled
/dev/sdf
/dev/sdg
HDIO_DRIVE_CMD(identify) failed: Invalid exchange
The /dev/sdg device is a USB drive and they dont play nice with hdparms commands usually.