This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import glob | |
| import xml.dom.minidom | |
| for f in glob.glob('*/WEB-INF/web.xml'): | |
| print f | |
| dom = xml.dom.minidom.parse(f) | |
| mappings = dom.getElementsByTagName('servlet-mapping') | |
| for m in mappings: | |
| urlp = m.getElementsByTagName('url-pattern')[0].firstChild.data | |
| sname = m.getElementsByTagName('servlet-name')[0].firstChild.data | |
| print " %s (%s)" %(urlp,sname) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from itertools import islice | |
| import os | |
| import sys | |
| import subprocess | |
| CMD = "sudo -u hdfs /usr/lib/hadoop/bin/hadoop dfsadmin -report" | |
| def parse(resultstr): | |
| dic = {} | |
| for line in islice(resultstr, 0, 8): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ $# -lt 1 ]; then | |
| SIZE="2048" | |
| else | |
| SIZE=$1 | |
| fi | |
| echo "HADOOP_HEAPSIZE=${SIZE}" >> /home/hadoop/conf/hadoop-user-env.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo -u hdfs hadoop fsck / -files -blocks | grep BAD_BLOCK_ID -B 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| hadoop job -list | grep job_ | awk 'BEGIN{FS="\t";OFS=","};{print $1,strftime("%H:%M:%S", (systime()-int($3/1000)),1),"\""$4"\"","\""$6"\""}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| USERNAME=admin | |
| PASSWORD=admin | |
| SCM_URL=http://localhost:7180 | |
| COOKIES_FILE=cookies.txt | |
| EXPORT_FILE=export.txt | |
| wget -q --post-data="j_username=${USERNAME}&j_password=${PASSWORD}" --save-cookies ${COOKIES_FILE} --keep-session-cookies -O /dev/null ${SCM_URL}/j_spring_security_check | |
| wget -q -O ${EXPORT_FILE} --load-cookies ${COOKIES_FILE} ${SCM_URL}/cmf/exportCLI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| STATE=`ps aux | grep "HiveServer" | wc -l` | |
| IP="127.0.0.1" | |
| PORT=10000 | |
| function do_restart() | |
| { | |
| echo Restarting | |
| cd / | |
| nohup hive --service hiveserver & | |
| echo $! > /var/run/hiveserver.pid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <protocol-plugin protocol="OracleMonitoring" class-name="org.opennms.netmgt.capsd.plugins.JDBCPlugin" scan="on"> | |
| <property key="driver" value="oracle.jdbc.driver.OracleDriver"/> | |
| <property key="user" value="opennms"/> | |
| <property key="password" value="opennms"/> | |
| <property key="url" value="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=OPENNMS_JDBC_HOSTNAME)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl)))"/> | |
| <property key="retry" value="1"/> | |
| </protocol-plugin> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ########## | |
| # For verification, you can display the OS release. | |
| ########## | |
| $ cat /etc/lsb-release | |
| DISTRIB_ID=Ubuntu | |
| DISTRIB_RELEASE=11.10 | |
| DISTRIB_CODENAME=oneiric | |
| DISTRIB_DESCRIPTION="Ubuntu 11.10" | |
| ########## |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| I ran into a situation where I needed to execute something as root, but the executable file needed access to environment variables that I had defined in my .bashrc file. | |
| To fix this, I added those same environment variable definitions from the .bashrc file to my /etc/environment file. Note that you need to remove the 'export' statement at the beginning of each variable you define in /etc/environment. |