Fastcloud’s Blog


How to find a string in zip files

I have a folder with a lot of subfolders and zip files in it.
Each zip file contains a set of subfolders and textfiles.
I use the following code in order to find a string in files which are stored in zip files:
FIND_THIS_STRING=Mbits
# find zip files recursively
for mFile in `find . -name "*.zip"`
do
# unzip each zip file to the pipe
# find the string in the extracted content and print the line which contains the string
unzip -p "$mFile" | grep "$FIND_THIS_STRING"
done

Comments Off

How to install SPECjAppServer2004 on Fedora 8 (JBoss and MySQL)

Last update: August 25, 2009
Installing the SPECjAppServer benchmark software is not trivial. There are a lot of obstacles and the installation and configuration on fedora is really painful. I spent about 14 man-days on this installation – please don’t underestimate the setup!

Goals:
Since I’ve spent a huge amount of time on this installation, this howto mainly aims to preserve my experiences for myself. But if you find it useful you’re invited to use it. This howto shows how to install the SPECjAppServer2004 V.1.08 on a distributed system under test (SUT) with the following components:
- The main application (SPECjAppServer2004 V.1.08) will run on JBoss 4.0.5 GA
- The database will be hosted on a MySQL 5.1 database server
- The emulator (which isn’t actually part of the SUT) will run on Tomcat 6.0.18
All systems will run Fedora Core 8. We’ll use Sun’s JDK 6 Update 13.
(more…)

Comments Off

How to install apache ant on Fedora 8

If you just want to run ant, install it using yum:

yum install ant

But if you need to execute the optional ant tasks like scp, junit, etc. you need to “install” ant manually. Please make sure that a java runtime is installed and the variable JAVA_HOME points to the root directory of the java installation.

Save this script as “install-ant.sh” and execute it as root:
yum install wget
cd /tmp
wget http://ftp.uni-erlangen.de/pub/mirrors/apache/ant/binaries/apache-ant-1.7.1-bin.tar.gz
tar xfz apache-ant-1.7.1-bin.tar.gz
mkdir /usr/share/ant
cp -r -f apache-ant-1.7.1/* /usr/share/ant/
export ANT_HOME=/usr/share/ant/
export PATH=$PATH:$ANT_HOME/bin
echo"
export ANT_HOME=/usr/share/ant
export PATH=$PATH:$ANT_HOME/bin:$JDK_HOME/bin
" >> /etc/profile
echo "apache ant has been installed."
exit;

If the script fails to download the tarball visit http://ant.apache.org/bindownload.cgi , coose another mirror and replace the url in the script above.

Comments Off

Centreon reporting module shows states as “undetermined”

Problem:
The hosts and services are correctly monitored in the “Monitoring” module but in the “Reporting” module all states are shown as undetermined.
Solution:
To get straight to the point: it is most likely, that a single setting is not configured correctly in the ndomod.cfg:
In the Centreon 2.0 webinterface go to
Configuration > Centreon > ndomod.cfg > Poller Prinzipal (or however it is named)
Now have a look at “Data processing options”. If it is set to “-1” nothing will be written to the database. In order to get it working you need to enter the correct value. Use “67108863” if “everything” should be written to the database. The German company Consol offers a free online calculator for the data_processing_options-setting.
If changing this value doesn’t fix your problem you need to check that your installation meets the following requirements:
1. Nagios is installed (preferably built from source!)
2. NDOUtils is installed
3. The NDO/Nagios database has been created and is accessible by the nagios db user
4. The NDO-daemon (ndo2db) is running
5. The settings for database name, db user, db password, log files, socket, buffer files, etc. are configured correctly in all configuration files (i. e. the values are equal)

Comments Off

How to remove line breaks/new lines in files using “tr”

A google search for “remove line breaks linux” returns 637000 results. I’ve tried at least ten approaches using sed, tr and awk in different combinations.
However, on my Fedora 8 machine only the following command works (in bash scripts):
cat oldfile | tr -d '\n ' > newfile

Comments Off

mysql -h localhost -u root -p myrootpassword produces “access denied” (or similar) errors

If the following command doesn’t work for you
mysql -h localhost -u root -p myrootpassword
and produces errors like:
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
or
ERROR 1049 (42000): Unknown database 'myrootpassword '
try the following command:
mysql -h localhost -u root -p Note: NO password is passed to the -p parameter!
You’ll be prompted for your password -> Enter it.

You could also try:
mysql -h localhost -u root --password="myrootpassword"

How to execute sql-script with the mysql console?
If you want to execute a *.sql-file you might try the following command:
mysql -h localhost -u root --password="myrootpassword" --database="mydb" < /path/to/my/sqlfile.sql -- Note: single line!

Comments Off

Fedora 8: assignment of static ip-addresses doesn’t work

Posted in Fedora related stuff by fastcloud on April 15, 2009
Tags: , , , ,

The assigment of static ip-addresses to my fedora 8 machines didn’t work – neither using the NetworkManager (the tool that opens upon clicking on the network-icon in the taskbar) nor the editing the config files manually.

I found the solution to this problem here: http://www.mjmwired.net/resources/mjm-fedora-f9.html#network

Open a terminal an type in the following commands:

su root
/etc/init.d/NetworkManager stop
/sbin/chkconfig --level 35 NetworkManager off
/sbin/chkconfig --level 35 network on
system-config-network
# Now configure the settings for your network card (e. g. eth0), enter the DNS, gateway and hostname and save. Select the network card an click on activate.
# close the configuration tool
/etc/init.d/network start
# check if your configuration has been applied:
/sbin/ifconfig
# check internet access:
ping fastcloud.wordpress.com

Comments Off

Follow

Get every new post delivered to your Inbox.