Skip to main content

Posts

Showing posts from November, 2012

Parse password file and populate variables

#!/bin/bash #ypcat passwd > /tmp/passwd cp /etc/passwd /tmp/passwd while IFS=: read -r user pass uid gid gecos home shell do   echo "ipa-moduser -a -s \"$shell\" -c \"$gecos\" -d \"$home\" $user" done < /tmp/passwd exit 0 Another approach... #!/bin/sh # 1 is the nis domain, 2 is the nis master server ypcat -d $1 -h $2 group > /dev/shm/nis-map.group 2>&1 IFS=$'\n' for line in $(cat /dev/shm/nis-map.group); do   IFS=' '   groupname=$(echo $line|cut -f1 -d:)   # Not collecting encrypted password because we need cleartext password to create kerberos key   gid=$(echo $line|cut -f3 -d:)   members=$(echo $line|cut -f4 -d:)   # Now create this entry   ipa group-add $groupname --desc=NIS_GROUP_$groupname --gid=$gid   if [ -n "$members" ]; then     ipa group-add-member $groupname --users=$members   fi   ipa group-show $groupname done

Change default background fedora 17

Update  /usr/share/backgrounds/beefy-miracle/default/beefy-miracle.xml with the path to the image you would like. cp ~jradtke/Pictures/Wallpapers/DigArt/SpaghettiMontster.jpg /usr/share/backgrounds/beefy-miracle/default/wide/ <background>   <starttime>     <year>2012</year>     <month>01</month>     <day>29</day>     <hour>00</hour>     <minute>00</minute>     <second>00</second>   </starttime> <static> <duration>10000000000.0</duration> <file>         <!-- Wide 16:10 -->         <size width="1680" height="1050">/usr/share/backgrounds/beefy-miracle/default/wide/ SpaghettiMontster.jpg </size>         <!-- Standard 4:3 -->         <size width="2048" height="1536">/usr/share/backgrounds/beefy-miracle/default/standard/beefy-miracle.png</size>         <!-- Normalish 5:4 -->

ksoftirqd consuming high cpu 100%

This happens to be a post from an experience on a Ubuntu machine... although the machine was practically unused, an entire CPU was consumed (by ksoftirqd) Resolution: # date -s "`date`" root@wwwsrv01:~#    uname -a Linux wwwsrv01 2.6.32-32-server #62-Ubuntu SMP Wed Apr 20 22:07:43 UTC 2011 x86_64 GNU/Linux root@wwwsrv01:~#   lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 10.04.2 LTS Release: 10.04 Codename: lucid root@wwwsrv01:~# top top - 23:02:11 up 491 days, 12:35,  1 user,  load average: 1.45, 1.37, 1.30 Tasks: 206 total,   2 running, 204 sleeping,   0 stopped,   0 zombie Cpu(s):  6.3%us, 12.0%sy,  0.0%ni, 81.6%id,  0.0%wa,  0.0%hi,  0.1%si,  0.0%st Mem:   8253648k total,  7464608k used,   789040k free,   448916k buffers Swap: 19771384k total,     3140k used, 19768244k free,  5471676k cached   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                              

named (bind) consumes over 100% of CPU

I am rebuilding out a lab environment and I installed BIND and attempted to run through everything from memory (instead of running my script or reading my docs...).  BIND was operating "fine", but I noticed that named was consuming around 123% of a CPU. There are a few things that I had not done, and in hindsight, I wish there was a simple how-to on the "correct" way to implement BIND in a best-practices way.  Instead of everyone posting how they did it... (one such example is a person that simply does a chmod 777 to get things rolling...). So -keep in mind that this is for my private lab... Anyhow - in summary: yum -y install bind-chroot chkconfig named on cp /etc/named.conf /etc/named.conf.orig mv /etc/named.conf /var/named/chroot/etc/ echo 'OPTIONS="-4"' >> /etc/sysconfig/named rndc-confgen -a -c /etc/rndc.key chmod 755 /etc/rndc.key cat /etc/rndc.key >> /var/named/chroot/etc/named.conf sed -i -e 's/127.0.0.1/

Cleaning up ZFS

I have a Sun USS 7110 with some issues.  I have had to swap OS drives between machines, at one point the drives were formatted for Linux, etc... At the end of the day, the USS 7110 (basically a Sun x4200) is most useful as it's intended purpose, a Unified Storage Array - imagine that? ;-) Anyhow... once you have the 2 OS drives configured correctly... go to work # echo | format | awk '{ print $2 }' DISKS="c0t5000CCA0002AF4B8d0 c0t5000CCA0002B33A0d0 c0t5000CCA0002CED64d0 c0t5000CCA0002D9A8Cd0 c0t5000CCA0002D9A44d0 c0t5000CCA0007AA6F4d0 c0t5000CCA0007ABB18d0 c0t5000CCA0007ABDBCd0 c0t5000CCA0007B632Cd0 c0t5000CCA0007B3934d0 c0t5000CCA00019B378d0 c0t5000CCA00031D8CCd0 c0t5000CCA000222E5Cd0 c0t5000CCA0002874C4d0" #c0t5000CCA0002CE1C4d0  -- OS Drive #c0t5000CCA00029536Cd0  -- OS Drive for DISK in $DISKS do   echo "dd if=/dev/zero of=/dev/rdsk/${DISK} bs=1024 count=72000"   dd if=/dev/zero of=/dev/rdsk/${DISK} bs=1024 count=72000

rename your "root" VG - Linux LVM

I will be updating this later...  I believe what I have here is accurate.  However, I have not tested it. NOTE: These specific steps will not work with Grub2. # vgs [root@neo ~]# vgs   VG     #PV #LV #SN Attr   VSize   VFree   vg_neo   1   5   0 wz--n- 451.66g 152.66g [root@neo ~]# vgrename vg_neo vg_noob [root@neo ~]# cp /etc/fstab /etc/fstab.bak [root@neo ~]# sed -i -e 's/vg_neo/vg_noob/g' /etc/fstab [root@neo ~]# sed -i -e 's/vg_neo/vg_noob/g' /boot/grub/grub.conf [root@neo ~]# sync [root@neo ~]# vgscan [root@neo ~]# shutdown now -r