Blog Archives

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

Posted in Linux

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

Posted in Linux

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

Posted in Linux

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

Posted in Installs, Linux, RAC

Global search and replace with sed and find

sed -e ‘s/old1/new1/g s/old2/new2/g s/old3/new3/g’ –i $(find / -name ‘*.php’ -o -name ‘*.include’ -o -name ‘*.inc’ -o -name ‘*.class’ -o -name ‘ht.access’) ‘locate’ would be an alternative to ‘find’.

Posted in Linux, Scripts

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

Posted in Linux, Scripts

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

Posted in Linux

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

Posted in Linux

Check if you work on a virtual/physical machine in Linux

http://www.spotht.com/2010/11/check-if-you-work-on-virtualphysical.html

Posted in Linux

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

Posted in Linux