Friday, September 16, 2011

How to fix "tail: cannot open `+2' for reading: No such file or directory"

In the name of God, Most Gracious, Most Merciful.

In this article i will be listing steps to fix "tail: cannot open `+2' for reading: No such file or directory" issue. This issue arises after installation of Grid Control 10g Release 2 on Linux Red Hat 5.0/5.3. This is due to old syntax of tail command used in script files trying to get Hardware details. To fix this issue just use following steps.


Step 1. Stop Grid Control Services.


$/u01/oracle/prdocut/10.2.0/grid/agent10g/bin/emctl stop agent
$/u01/oracle/prdocut/10.2.0/grid/oms10g/opmn/bin/opmnctl stopall

Step 2. Take Backup of files which are using old syntax of tail command.


$ mkdir -p /tmp/agent/backup
$ mkdir -p /tmp/oms/backup
$ cd /u01/oracle/product/10.2.0/grid/agent10g/sysman/admin/scripts
$ for file in *; do if grep -i -l "tail +" "$file"; then cp "$file" /tmp/agent/backup/ ;fi; done

$ cd /u01/oracle/product/10.2.0/grid/oms10g/sysman/admin/scripts
$for file in *; do if grep -i -l "tail +" "$file"; then cp "$file" /tmp/oms/backup/ ;fi; done

Step 3. Update files of agent and oms

$ cd /u01/oracle/product/10.2.0/grid/agent10g/sysman/admin/scripts
$ mkdir -p /tmp/agent/modified 
$ for file in *; do if grep -i -l "tail +" "$file"; then cp "$file" /tmp/agent/ && sed -e 's/tail +/tail -n +/g' /tmp/agent/$file > /tmp/agent/modified/$file; cp /tmp/agent/modified/* .;fi; done

$ for file in *; do if grep -i -l "tail +" "$file"; then cp "$file" /tmp/agent/ && sed -e 's/TAIL +/TAIL -n +/g' /tmp/agent/$file > /tmp/agent/modified/$file; cp /tmp/agent/modified/* .;fi; done

$ cd /u01/oracle/product/10.2.0/grid/oms10g/sysman/admin/scripts

$ mkdir -p /tmp/oms/modified 

$ for file in *; do if grep -i -l "tail +" "$file"; then cp "$file" /tmp/oms/ && sed -e 's/tail +/tail -n +/g' /tmp/oms/$file > /tmp/oms/modified/$file; cp /tmp/oms/modified/* .;fi; done



$ for file in *; do if grep -i -l "tail +" "$file"; then cp "$file" /tmp/oms/ && sed -e 's/TAIL +/TAIL -n +/g' /tmp/oms/$file > /tmp/oms/modified/$file; cp /tmp/oms/modified/* .;fi; done

Step 4. Start Grid Control Services.


$/u01/oracle/prdocut/10.2.0/grid/oms10g/opmn/bin/opmnctl startall
$/u01/oracle/prdocut/10.2.0/grid/agent10g/bin/emctl start agent





Insha-Allah this will help and serve the purpose. For any corrections and improvements please suggest.





No comments:

Post a Comment