Skip to main content

Posts

Showing posts from 2013

Subscription-manager

I am hopeful that someday I proclaim how great subscription-manager is and I can't believe we survived without it.  However, for now - I am slightly confused and wondering what the advantages are ;-) subscription-manager register subscription-manager auto-attach subscription-manager subscribe --auto

Adding External Repos to Spacewalk

I have a current objective that requires I take some risks with configuration setting on my Spacewalk system, which ends up being easier to start over with a new deployment.  And I had grown sick of the manual process adding a repo and associating it with a channel. cat << EOF >> /etc/rhn/spacewalk-common-channels-3rd-party.ini [epel-6] label    = epel-6 %(base_channel)s archs    = %(_x86_archs)s name     = EPEL 6 - (%(arch)s) base_channels = centos6-%(arch)s yumrepo_url = https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=%(arch)s [puppetlabs-products] label    = puppetlabs-products archs    = %(_x86_archs)s name     = Puppet Labs Products El 6 - (%(arch)s) base_channels = centos6-%(arch)s yumrepo_url = http://yum.puppetlabs.com/el/6/products/%(arch)s [puppetlabs-deps] label    = %(base_channel)s archs    = %(_x86_archs)s name     = Puppet Labs Dependencies El 6 - (%(arch)s) base_channels = centos6-%(arch)s yumrepo_url = http://yum.puppetlabs.com/el/6/depe

Update crontab from command line

I occasionally need to update the cron on a TON of hosts, and don't want to run crontab -e a TON of times.. crontab -l | grep 'chmod 666' == Add an entry to an existing crontab == if [ $? -ne 0 ] then   cat <(crontab -l) <(echo "* * * * * chmod 666 /u01/core/*") | crontab -   echo "NOTE: cron updated" else   echo "NOTE: cron was already updated" fi == Remove something from a crontab [root@dvgllpsmsapp13 ~]# crontab -l # Chmod something 0 0 * * * chmod 777 /tmp/test 0 0 * * * chown 777 /tmp/test [root@dvgllpsmsapp13 ~]# cat <(crontab -l | grep -vi chmod) | crontab - [root@dvgllpsmsapp13 ~]# crontab -l 0 0 * * * chown 777 /tmp/test [root@dvgllpsmsapp13 ~]#

Core dump ignores facl (setfacl) in RHEL

I had been tasked with figuring out how to have an environment that would allow multiple users to access core files.  I thought: simple enough, I'll just have to mess around with the facl for the directory, specifically the "default" entry. Well, I was wrong.  I had attempted: # remount filesystem and enable acl chmod 775 /u01/core chmod g+s /u01/core chgrp smsvcs /u01/core setfacl -m g::rwx,o:rwx,d:o::r-x /u01/core It turns out that the coredump function (do_coredump) creates the file 0600 int do_coredump (long signr, struct pt_regs * regs ) 919 { 920 struct linux_binfmt * binfmt; 921 char corename[6+sizeof( current -> comm )]; 922 struct file * file ; 923 struct inode * inode ; 924 925 lock_kernel (); 926 binfmt = current ->binfmt; 927 if (!binfmt || !binfmt->core_dump) 928 goto fail; 929 if (! current ->dumpable || atomic_read (& current ->

HBA card report

Found a cool script that I wanted to "archive" http://yenonn.blogspot.com/2013/10/script-to-report-hba-cards-status.html Author: yenonn@gmail.com function check_hba () {         # Checking Emulex HBA cards status         if grep -q -i "online" /sys/class/fc_host/host*/port_state 2>/dev/null         then                  num_online_hba=`grep -i "online" /sys/class/fc_host/host*/port_state | wc -l`                 total_hbas=`ls -1 /sys/class/fc_host/host*/node_name | wc -l`                 echo "Linux discovered $num_online_hba HBAs is online out of $total_hbas cards."                 for h in `ls -1 /sys/class/fc_host/host*/node_name | awk -F/ '{print $5}'`                 do                         wwn=`cat /sys/class/fc_host/$h/port_name`                         state=`cat /sys/class/fc_host/$h/port_state`                         #modelname=`cat /sys/class/scsi_host/$h/modelname`                         #echo &q

Repo Sync to non-current CentOS release

WARNING:  This might actually screw up your Spacewalk system :-(  I think the correct path would be to sync 6.3 first, then 6.4, etc... Feel free to attempt it though. I'm attempting to build out a FOSS (emphasis on FREE ;-) replica of my RHEL environment at work in my home.  Seems simple enough.  One significant difference is how Satellite varies from Spacewalk in initial sync. My goal is to use spacewalk-clone-by-date to show how you can utilize "rolling" channel release dates and use the clone to bring the channel up to a date that you would like all your hosts patched "current" to.  The problem is: I built my spacewalk server in November of 2013 and the only release it seems to have grabbed is 6.4.  So, any arbitrary date I select, simply defaults back to 6.4 as that is all I have. So - I don't want to get terribly in-depth, but I decided I can conclude my testing if I had two minor-release versions - 6.4 and 6.3. My spacewalk repo for "b

Kickstart Failure on dbus

Summary:  if you see "a fatal error occurred when installing dbus" during kickstart, remove the Updates Channel from your available repos for that kickstart. I am trying to replicate my Satellite environment from work at home using Spacewalk.  Granted, paying for support on Red Hat affords you a number of advantages, and the RHN Tools channel is one of them.  I like to automate everything as much as possible, but also have it straight-forward and simple, that way when I upgrade/migrate/whatever - I am not spending time trying to determine what I had originally intended to do and then how to make it work again. Anyhow.. the issue was that I was unable to get my system to register to the Spacewalk system during kickstart (rhnreg_ks, etc.. was not there).  I was unsure which channel contained the necessary pieces, so I updated my kickstart image to simply use ALL the Channels I had.  After which I received the following error during install: a fatal error occurred when i

Add Puppet Labs Repo to Satellite/Spacewalk

I specifically did this on my Spacewalk system (not Satellite) but I assume the procedure is the same. NOTE: If someone feels this is not a valid approach to this, please let me know and I will update the approach or take it down. - You do NOT need to do this part - I downloaded and installed the Puppet RPM to gather info regarding their public repo sudo rpm -ivh http://yum-enterprise.puppetlabs.com/el/6/extras/x86_64/puppetlabs-enterprise-release-extras-6-2.noarch.rpm  - You do NOT need to do this part -       I only imported that RPM to get the following info (/etc/yum.repos.d/puppetlabs.repo)   [puppetlabs-products] name=Puppet Labs Products El 6 - $basearch baseurl=http://yum.puppetlabs.com/el/6/products/$basearch gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs enabled=1 gpgcheck=1 I also used the name of the repo they have chosen. Then login to your Spacewalk admin portal, click on  Channels | Manage Software Channels | Manage Repositories Add the UR

Update or Install DRAC license from OS

I had a motherboard replaced due a DRAC failure.  Once the system came back up, I noticed the DRAC was still offline... ugg... After further digging and several reboots, I determined that the DRAC was not a viable option to configure.  More digging indicated that my Enterprise DRAC license was not present.  Unfortunately this was hours after my change window expired.  So - now that I have a DRAC license, how do I get it on my system without a reboot. ~~~ [root@server ~]# ls /opt/dell/srvadmin/bin/idracadm && myRACADM="/opt/dell/srvadmin/bin/idracadm" [root@server ~]# ls /opt/dell/srvadmin/bin/idracadm7 && myRACADM="/opt/dell/srvadmin/bin/idracadm7" [root@server ~]# $myRACADM config -g cfgLanNetworking -o cfgNicSelection 1 ERROR: SWC0242 : A required license is missing or expired. Obtain an appropriate license and try again, or contact your service provider for additional details. Required License -- Dedicated NIC ~~~ After

Backup and Restore Kickstart Profiles

We had an issue which was the result of our "Organization" changing when we renewed our Certificate (to add entitlements).  It was a seemingly harmless change, which caused some huge issues.  Basically the person that created our Certificate capitalized all of the letters in our Organization name, whereas everything had been originally created with mixed-case letters. I.e. What a Bummer != WHAT A BUMMER Anyhow - I recommend doing this as part of your daily backup procedure regardless... tar -cvf ${BACKUPDIR}/var_lib_rhn_kickstarts_upload.tar /var/lib/rhn/kickstarts/upload/ You will know that kickstart profiles are screwed up when you attempt to modify them and you get an error, followed by a blank profile the next time you attempt to modify it. The recovery: rhn-satellite stop cp  var_lib_rhn_kickstarts_upload.tar / tar -xvf var_lib_rhn_kickstarts_upload.tar rm /var/lib/cobbler/config/profiles.d/ rhn-satellite start

3rd party Reposync - RHN Satellite

We import a number of packages from 3rd party repos (Oracle, EPEL, Nginx) in to our Satellite. Here is a script I created which manages our 3rd-party-reposync #!/bin/sh ## ## THIS SCRIPT RELIES ON THE RHNSAT HOST HAVING A YUM REPO DEFINED FOR THE ## VENDOR SUPPLIED REPO ## ## YOU WILL NEED TO ENABLE THE PUBLIC ORACLE REPO FOR ##   el5_latest ##   ol6_latest ## NOTE: You definitely need to include/exclude packages specific to oracleasm NOTIFICATION=0 CONFIG=/etc/yum.conf.reposync EMAIL=james.radtke@blah.com LOGFILE=/tmp/3rd-party-reposync.out LOCKFILE=/var/run/3rd-party-reposync.lock DEBUG=0 DOM=`date +%d` # THE VALUE AFTER THE % SIGN IS THE DIVISOR (i.e. %6 means 6/12/18/24/30) MOD=$((DOM%7)) PWD=`pwd` clear echo "Output is sent to: $LOGFILE" echo "To view output, run:" echo "tail -f $LOGFILE" if [ $NOTIFICATION == 1 ] then   exec > $LOGFILE 2>&1   date fi # DETERMINE IF A PREVIOUS REPOSYNC IS STILL RUNNING lockfile -r 0 ${LOCKFILE} 1>/

rename DRAC from CLI OS

For some reason, a number of our physical hosts do not have their DRACs configured correctly, or according to our standard. I wrote this script to clean them up. #!/bin/bash # Desc:  This horribly assembled bit of scripting is intended to configure the DRAC using #        a few basic fundamental configuration variables. #        The end result should be a host DRAC that is reachable via #        <hostname>.mgmt.company.com # A few helpful commands to review: # /opt/dell/srvadmin/bin/idracadm7 getconfig -g cfgLanNetworking # /opt/dell/srvadmin/bin/idracadm config -g cfgLanNetworking -o cfgDNSRacName `hostname -s` yum -y install srvadmin-all srvadmin-idrac7 ls /opt/dell/srvadmin/bin/idracadm && myDRAC="/opt/dell/srvadmin/bin/idracadm" ls /opt/dell/srvadmin/bin/idracadm7 && myDRAC="/opt/dell/srvadmin/bin/idracadm7" if [ -z $myDRAC ] then   echo "ERROR: idracadm[7] was not found"   echo "       yum -y install srvadmin-all srvadm

DRAC and OpenIPMI

DISCLAIMER:  The majority of the page was most definitely stolen from http://www.openfusion.net/tags/dell - Gavin Carr invested a bit of time in to creating this information.  I am making my own copy just in case his disappears someday. Spent a few days deep in the bowels of a couple of datacentres last week, and realised I didn't know enough about Dell's DRAC base management controllers to use them properly. In particular, I didn't know how to mess with the drac settings from within the OS. So spent some of today researching that. Turns out there are a couple of routes to do this. You can use the Dell native tools (e.g. racadm ) included in Dell's OMSA product , or you can use vendor-neutral IPMI , which is well-supported by Dell DRACs. I went with the latter as it's more cross-platform, and the tools come native with CentOS, instead of having to setup Dell's OMSA repositories. The Dell-native tools may give you more functionality, but for what I wante

Display LUN information for ASM devices RHEL 5 and 6

I know close to nothing about Per l .  This script was created on RHEL 5 an d I wanted t he functi onality to be extended to RHEL 6.   In regards to our script t he signif icant differen ces between RHEL 5 and 6 are: RHEL 5 /dev/mpath     -- path to m ultipath devices  \_                   -- identifier for multipath device RHEL 6 /dev/mapper   - - path to m ultipath devices   |-                   -- identifier for multipath device   `-                  -- identifier for multipath device   #!/usr/bin/perl @rhelver = `cat /etc/redhat-release`; $rhelver[0] =~ / (\d\.\d) /;      $RELEASE = $1; # ARRAY OF HDS ARRAYS $sxm_arrays = {   '726a'=>'ITSHDS05',   '71c9'=>'ITSHDS06',   '61bc'=>'ITSHDS04',   '4ed0'=>'ITSHDS01',   '5b68'=>'ITSHDS02',   '03da'=>'ORION1',   '03f6'=>'TITAN1',   'ac75'=>'ATLAS',   'ba9e'=>

Checking memory usage (for Apache)

ps -ylC httpd | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}' acquired from: http://webserverpage.com/how-to-measure-or-calculate-maximum-memory-usage-of-apache/ #!/bin/bash if [ $# -ne 1 ] then   echo ""   echo "ERROR: pass in process name"   echo "  $0 {httpd|java}"   echo ""   exit 9 fi echo "* * * * * * * *" uname -n ps -ylC ${1} | awk '{x += $8;y += 1} END {print "'${1}' Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}' echo "" exit 0 morpheus:~ jradtke$ for HOST in 2 3 4 5; do ssh fatapp0${HOST} "uname -n; for PROC in httpd java; do /opt/bin/check_process_memory.sh \${PROC}; done"; echo; done

BASH foo

Update a file named after a "system" with the IP address from a ":" delimited text file. system:192.168.0.100 cat list | awk -F\: '{ print $1" "$2 }' | while read SYS IP; do echo "address $IP" >> ${SYS}.cfg ; done - Passing responses in to an install script ( echo NB_CLT_7.5.0.6; echo y; echo q; echo y ) | ./NB_update.install This.. is awesome To get the text between two 'strings'  cat sar11 |  awk '/plist-sz/,/Average/ ' 00:00:01      runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15 00:01:01            2       998      1.14      0.38      0.18 00:02:01            1      1006      2.35      0.91      0.38 00:03:01            1       998      1.63      0.97      0.43 --- --- ---  ---  23:52:01            0       974      0.30      0.19      0.19 23:53:01            1       972      0.40      0.23      0.20 Average:            1       912      1.19      1.19      1.16

sudo using X11 forwarding

I have a need to export my display from a RHEL host AFTER I have sudo'd to root... (such as virt-manager console) xauth list | grep `uname -n` > /tmp/`logname`-xauth && chmod 660 /tmp/`logname`-xauth sudo su - LOGNAME=`logname` xauth add `tail -1 /tmp/${LOGNAME}-xauth` virt-manager

Script Template (for version control RCS)

The following is a script header/template that I will use which works with RCS to update the version in the file #!/bin/bash # ### BEGIN BUILD INFO # @(#)$Id: ruhroh,v 1.2 2013/10/08 14:13:04 root Exp $ # Build System:         pdgllprhnsat01.corp..com ### END BUILD INFO # ### BEGIN INIT INFO # chkconfig: 2345 99 01 # Provides:           ruhroh # Required-Start:    N/A # Default-Stop:     0 1 2 3 4 5 6 # Default-Start:     3 5 # Short-Description:     Emails users when system is shutdown or started # Description:         Sends an email at system start and shutdown ### END INIT INFO

RHN Satellite Troubleshooting - Configuration File Deployment fails

This is an extremely ambiguous situation... but it happens to me frequently enough that I will document it. Take the following scenario... /home - directory /althome - symlink back to /home I will build a new system.  Unfortunately I login as myself for the first time (before I bootstrap, etc...).  I use "enablemkhomedir" and my home directory is listed as /althome/jradtke - so, when I login, it creates 2 directories: /althome & /althome/jradtke When I go to subscribe my system to Satellite and have it autodeploy the config files, it will fail [Mon Jan 21 19:57:06 2013] up2date Traceback (most recent call last):   File "/usr/sbin/rhn_check", line 332, in __run_action     (status, message, data) = CheckCli.__do_call(method, params, kwargs)   File "/usr/sbin/rhn_check", line 325, in __do_call     retval = method(*params, **kwargs)   File "/usr/share/rhn/actions/configfiles.py", line 222, in deploy     dep_trans.rollba

Cron Errors

Not sure how to file this particular issue, as it probably is not very common. Summary:  if you see "Unable to change UID to" or "Unable to change GID to"  in your syslog, you should go review the file ownership and file name of your cron files. Sep 13 10:25:02 c ypher crond[32723]: pam_keyinit(crond:session): Unable to change GID to 1063 temporarily Sep 13 10:25:02 cypher crond[32723]: pam_keyinit(crond:session): Unable to change UID to 60064 temporarily  My specific issue happe ned because a username was changed which had the UID of 600 64. Previously  jradtke:x: 60064 :1 063 :J ames Radtke :/home/ jradtke :/bin/bash  [jradtke@cyper Kickstart]$ sudo ls -l /var/spool/cron/ | grep jrad -rw-------. 1 jradtke jradtke 25 Sep 13 11:57 jradtke N ow.. my username had been changed to jradtke@c o rp.company.com jradtke@c o rp.company.com :x: 60064 :1 063 :J ames Radtke :/home/ jradtke :/bin/bash To remedy th e issue: mv /var/spool/cron /jradtke /var/s

Regex foo - checking crashkernel value

I need to check the crashkernel setting on all of my hosts. The issue(s): crashkernel=<blah> can exist anywhere in the string  there may be several iterations of a boot entry which contains crashkernel In this example, I purposely used a grub.conf which had 2 different crashkernel values to demonstrate how to change the enumeration of the test (either 1 or 2). [root@rhvsrv01 ~]# egrep '^[[:space:]]*kernel /vmlinuz.*crashkernel=' /boot/grub/grub.conf | sed -r '1!d;s/.*crashkernel=([[:graph:]]+).*/\1/' auto   [root@rhvsrv01 ~]# egrep '^[[:space:]]*kernel /vmlinuz.*crashkernel=' /boot/grub/grub.conf | sed -r '2!d;s/.*crashkernel=([[:graph:]]+).*/\1/' 16M@128M [root@rhvsrv01 ~]# grep vmlinuz /boot/grub/grub.conf | grep -v \#     kernel /vmlinuz-2.6.32-358.2.1.el6.x86_64 ro root=/dev/mapper/VolGroup00-LogVol01 rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup00/LogVol01 rd_LVM_LV=VolGroup00

Staring at the Sun... what process is using a port

I found a nifty script out there that would pound through the /proc files and figure out what process(es) had a particular port without the use of lsof. I, unfortunately, do not know who to credit for this piece of work but I will gladly update this if someone knows the creator. #!/bin/ksh line='---------------------------------------------' pids=$(/usr/bin/ps -ef | sed 1d | awk '{print $2}') if [ $# -eq 0 ]; then    read ans?"Enter port you would like to know pid for: " else    ans=$1 fi for f in $pids do    /usr/proc/bin/pfiles $f 2>/dev/null | /usr/xpg4/bin/grep -q "port: $ans"    if [ $? -eq 0 ]; then       echo $line       echo "Port: $ans is being used by PID:\c"       /usr/bin/ps -ef -o pid -o args | egrep -v "grep|pfiles" | grep $f    fi done exit 0

VMware Workstation 9 and Fedora 19

I still find numerous things quirky with VMware Workstation on Fedora. Issue 1:  Workstation does not run You will likely see something like the following in the modconfig output: $ cat /tmp/vmware-jradtke/vmware-modconfig-15048.log ... /lib/modules/3.10.4-300.fc19.x86_64/build/include/linux/version.h .... So -- do the following (works on 2013-08-09) cd /var/tmp curl -O http://pkgbuild.com/git/aur-mirror.git/plain/vmware-patch/vmblock-9.0.2-5.0.2-3.10.patch curl -O http://pkgbuild.com/git/aur-mirror.git/plain/vmware-patch/vmnet-9.0.2-5.0.2-3.10.patch cd /usr/lib/vmware/modules/source tar -xvf vmblock.tar tar -xvf vmnet.tar patch -p0 -i /var/tmp/vmblock-9.0.2-5.0.2-3.10.patch patch -p0 -i /var/tmp/vmnet-9.0.2-5.0.2-3.10.patch tar -cf vmblock.tar vmblock-only tar -cf vmnet.tar vmnet-only rm -r vmblock-only rm -r vmnet-only vmware-modconfig --console --install-all Issue 2:  You cannot apply the license via the GUI Run the following command: /usr/lib/vmware/bin

RHN Satellite Server (spacewalk) repomd.xml not found

"repomd.xml not found" If you add a channel, or if your RHN cache gets corrupted, and one of your guests complains that it cannot find repomd.xml for jb-ews-2-x86_64-server-5-rpm (for example) - you need to rebuild your repodata cache. Normally this is an automated job - which is exemplified by the fact that you have obviously built out your entire Satellite environment and never had to do any of the steps you are about to do. So - some prep work: Open 3 terminals to your Satellite Server and run: # Term 1 cd /var/cache/rhn watch "ls -l | wc -l" # Term 2 pwd cd /var/log/rhn tail -f rhn_taskomatic_daemon.log # Term 3 satellite-sync --channel=jb-ews-2-x86_64-server-5-rpm Once the satellite-sync has completed, you >should< see the count increment by one.  If you are unlucky (like me) you will not. You then need to login to the Satellite WebUI as the satellite admin user. Click on the Admin tab (at the top) Task Schedules (on the left) fin

Kickstart RHEL 6 using Mirrored Disks (software RAID)

I have a host at home with 2 x 1TB SATA disks.  I don't necessarily need the redundancy on this box, but I thought since I was bothering to get my PXE and kickstart working at home I may as well figure this out as well... -- excerpt from kicksart profile -- # Clear the Master Boot Record zerombr # Remove ALL partitions clearpart --all --initlabel --drives=sda,sdb # Install the bootloader in the MBR bootloader --location=mbr --driveorder=sda,sdb part /boot/efi --fstype=efi --size=500 --ondisk=sda part /boot/efi-dummy --fstype=ext4 --size=500 --ondisk=sdb # You cannot define a specific partition ('onpart') if you use 'clearpart' part raid.sda2 --asprimary --fstype="raid" --ondisk=sda --size=512 part raid.sdb2 --asprimary --fstype="raid" --ondisk=sdb --size=512 part raid.sda3 --asprimary --fstype="raid" --ondisk=sda --size=51200 --grow part raid.sdb3 --asprimary --fstype="raid" --ondisk=sdb --size=51200 --grow

More Satellite Foo - Database Edition

This particular post should not be taken lightly, nor implemented without consideration.  I believe our situation might be a bit different than most in that we rely on the clients to "pull" from the Satellite (using rhnsd and rhn_check).  I believe a better solution is to use OSAD - but at this point I am uneducated on such magic. :-( The goal here is to increase the number of Oracle DB connections. /bin/sqlplus rhnsat/rhnsat@rhnsat == Check number of Oracle Processes [root@rhnsat01 ~]# su - oracle -bash-3.2$  ORACLE_SID=rhnsat sqlplus /nolog SQL*Plus: Release 10.2.0.4.0 - Production on Tue Jul 16 12:03:19 2013 Copyright (c) 1982, 2007, Oracle.  All Rights Reserved. SQL> connect Enter user-name: XXXYYY Enter password: Connected. SQL> show parameter process; NAME                     TYPE     VALUE ------------------------------------ ----------- ------------------------------ aq_tm_processes              integer     0 db_writer_processes             integer     

Checking SWAP on RHEL

the quickest/simplest method seems to be run top then press "O p" Otherwise I have found some scripts out there to do similar reporting. DISCLAIMER: I did not write this script, nor do I endorse it.  There is a TON of new file creation and overwrite and then removal of files.  So - test this on a host that is not that important, or as a non-root user. #!/bin/bash # find-out-what-is-using-your-swap.sh # -- Get current swap usage for all running processes # -- # -- rev.0.3, 2012-09-03, Jan Smid - alignment and intendation, sorting # -- rev.0.2, 2012-08-09, Mikko Rantalainen - pipe the output to "sort -nk3" to get sorted output # -- rev.0.1, 2011-05-27, Erik Ljungstrom - initial version SCRIPT_NAME=`basename $0`; SORT="kb"; # {pid|kB|name} as first parameter, [default: kb] [ "$1" != "" ] && { SORT="$1"; } [ ! -x `which mktemp` ] && { echo "ERROR: m

BASH profile setup

#******************************************************************************** # .bashrc #******************************************************************************** # .bashrc # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # User specific aliases and functions function set_title {   title=$1;   echo -e "\033];${title}\007"; } # replaced the following by using ~/.ssh/config #alias ssh="ssh -o TCPKeepAlive=yes -o ServerAliveInterval=50 -XCA ${1}" alias vms="sudo virsh list --inactive --all" alias vv="sudo virt-viewer ${1}" alias doover='/usr/bin/sudo $(history -p \!\!)' alias please='/usr/bin/sudo $(history -p !!)' alias itunes='/usr/bin/vncviewer --CompressLevel=6 cypher.matrix.private' #******************************************************************************** # .bash_profile #****************************************************************************

Check my disk space usage

A database system is reporting it is out of disk... After cleaning up an 8GB root mail file and a few other users... things are OK... but the Free Space is disappearing! I found a snippet of shell foo that I thought was useful (site listed below) hdparm -tT /dev/sda Unix and Linux System Administ (Google Affiliate Ad) Building Embedded Linux System (Google Affiliate Ad) sort by size: sudo lsof -s | awk '$5 == "REG"' | sort -n -r -k 7,7 | head -n 50   process with most files open: sudo lsof | awk '$5 == "REG" {freq[$2]++ ; names[$2] = $1 ;} END {for (pid in freq) print freq[pid], names[pid], pid ; }' | sort -n -r -k 1,1  References: http://thegoogleof.blogspot.com/2011/11/lsof-sort.html http://www.ibm.com/developerworks/aix/library/au-lsof.html