Bash script to check for final closing /data xml tag in file

Bash script to check for final closing </data> xml tag in file: if [ -f file.xml ] then # if grep -1iq ‘</data>’ file.xml # simplest syntax # if tac file.xml | grep -1iq ‘</data>’ # faster syntax (tac is reverse cat) if tail -100 file.xml | grep -1iq ‘</data>’ # fastest syntax, assumes at […]

Read More Bash script to check for final closing /data xml tag in file
June 23, 2015

One Comment

sda: sense key Recovered Error linux fsck forcefsck

Errors in /var/log/messages: kernel: Current sda: sense key Recovered Error kernel: Additional sense: Failure prediction threshold exceeded kernel: EXT3-fs error (device sda9) in ext3_setattr: Journal has aborted kernel: EXT3-fs error (device sda9) in start_transaction: Journal has aborted Fix with (requires reboot + can be slow): fsck.ext3 -f -y /dev/sda9 To identify that name /dev/sda9 I […]

Read More sda: sense key Recovered Error linux fsck forcefsck
November 18, 2013

Yum update nohup Insufficient space in download directory

Yum update is used to patch red hat/oracle enterprise linux. Can take a while, so best run nohup: rm -f nohup.out nohup yum -y update & By default yum stores its temporary downloads into /var, if that is low in space a symbolic link will workaround: rm -fr /var/cache/yum/updates/packages mkdir /bigfs/packages ln -s /bigfs/packages /var/cache/yum/updates/packages […]

Read More Yum update nohup Insufficient space in download directory
July 3, 2013

Patch upgrade Oracle RAC 11.2.0.2 to 11.2.0.3 on linux

I used the steps below to apply patchset 11.2.0.3 to an existing 11.2.0.2 2-node RAC cluster on linux RHEL 5.8 64 bit. Note that GRID_HOME and DB_HOME locations will both be changed as part of this patchset. 0) Download and unzip software from My Oracle Support into e.g. /unzipped Main patch is 7 large zipfiles, […]

Read More Patch upgrade Oracle RAC 11.2.0.2 to 11.2.0.3 on linux
March 1, 2013

sed change entire line

Here I use sed to replace the entire 2nd line in a lot of files with a new 2nd line. The shell script: for fle in `ls *.msg` do # copy file first so as can keep permissions and ownership identical cp -p $fle test_$fle # replace entire 2nd line with a new 2nd line […]

Read More sed change entire line
June 8, 2011

RAID internal hard disks linux

Useful commands to show RAID level of internal hard disks. On HP blade servers: /usr/sbin/hpacucli controller all show status /usr/sbin/hpacucli controller slot=0 logicaldrive all show On other servers: cat /proc/mdstat

Read More RAID internal hard disks linux
June 6, 2011

Cron during British Summer Time / Daylight Saving Time

For older versions of unix/linux, crons running at 01.* (anything from 01:00 to 01:59) do not run during the Spring Sunday time change. Those sames crons will run twice during the Autumn time change. So it is important to not use 01.* times in your cron entries, for anything which runs on a Sunday. Newer […]

Read More Cron during British Summer Time / Daylight Saving Time
April 6, 2011

FTP 421 service not available tcp wrapper hosts.allow

Files /etc/hosts.allow and /etc/hosts.deny control tcp wrapper permissions for incoming requests to linux servers. Ftp access is normally controlled by the ‘vsftpd’ line, e.g.: vsftpd: 138.134.116. 138.134.117. That would allow ftp connections from IP addresses like 138.134.116.x and 138.134.117.x. If your IP address is not in the allow list, ftp attempts will fail with an […]

Read More FTP 421 service not available tcp wrapper hosts.allow
January 6, 2011