Category Archives: sys admin

wkhtmltopdf install on Centos 6

htlp to pdf

from Google code site – what is wkhtmltopdf :

Simple shell utility to convert html to pdf using the webkit rendering engine, and qt.

All the tutorials I found on the net are how to install it via aptitude, 
but I needed to install from source a specific older version , so this is what i did:

Preperations

install all the needed packages  – these are going to be a big bunch:

yum -y install openssl xorg-x11-server-Xorg openssl-devel qt qt-devel gcc-c++ qtwebkit qtwebkit-devel xorg-x11-server-Xvfb 

Get the code

you can download the source code from https://code.google.com/p/wkhtmltopdf/
I need the 0.9.9 version so I took that one

cd /root
wget "https://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9.tar.bz2"
bunzip2 wkhtmltopdf-0.9.9.tar.bz2
tar xvf wkhtmltopdf-0.9.9.tar
cd wkhtmltopdf-0.9.9

 

fix error in code 

there was a problem to compile the code due to a link to a non existing module:

cp wkhtmltopdf.pro wkhtmltopdf.pro_bak
vim wkhtmltopdf.pro 
change line 19 from:
PRL  = $$[QT_INSTALL_LIBS] QtGui.framework/QtGui.prl
to: 
PRL  = $$[QT_INSTALL_LIBS] libQtGui.prl
save and exit 

compile !

qmake-qt4
make
make install

test !

we need to run the wkhtmltopdf in a virtual screen so the test line would look like:

xvfb-run --server-args="-screen 0, 1024x768x24" wkhtmltopdf http://www.google.com google.pdf

Technorati Tags: , ,

Postfix queue management – list, debug and clean

Postfix mail server

 

Pstfix mail server and acomulate a queue of stuck emails, 
we monitor them via Nagios and sometime get alerts similar to this one,
there are some methods to take care of this queue:

 

msg_q = 17 warn=10 crit=20
WARNING: mailq is 17 (threshold w = 10)

log into the mail server and use the list command to see the mail queue:

mailq

-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
AAE603481BD 3471 Thu Oct 18 14:44:30  user@domain.com
(connect to outside.com[xxx.xxx.xxx.xxx]: Connection timed out)
user2@outside.com


the Q-id number is the id for the mail , you can read the mail to understnad what it is about and why its stuck with:

postcat -q AAE603481BD

you can delete it with:

postsuper -d AAE603481BD 

 

useful bash loop to delete all mails from do-not-reply@domain.com:

for i in $(mailq | grep -B1 'do-not-reply@domain.com'| grep '^[A-Z,0-9]'| awk '{print $1}')
do 
postsuper -d $i
done

 

 

Technorati Tags: , ,

Finally a Linux jmx query tool that works out of the box!

I've tried many many jmx query tools from the command line, 
windows has the jconsole tool which is a part of the Java binaries pack, and works fine, 
but it is not a command line tool – it has a nice GUI. 

this command line jar works like a charm, 
displays all the beans it finds, and allows you to invoke them , 

take a look at :

http://crawler.archive.org/cmdline-jmxclient/

only the cmdline-jmxclient-0.10.3.jar files is available for some reason, 
searches in google didnt find the newer file at all. 

than you run it with :

java -jar cmdline-jmxclient.jar – SERVER:PORT

to get a listing of all the available beens.

more samples are available on the link above. 

works like a charm!

 

Technorati Tags: , ,

Exporting MediaWiki sites to Google sites

In the last post I’ve talked about moving files from SharePoint to Google Site,

what about a Mediawiki site?
how to export it and upload it?
I’ve already covered the uploading files to Google sites via the Google sites API,
you can use java or python to write a script to mass upload all your files and htmls to your new google site,
but first you need to export everything out of the Mediawiki site.

here is a working method to export your site, these are the steps:

  1. install python
  2. download the mw2html script
  3. export the mediawiki site

Technorati Tags: , , , ,

SharePoint to Google sites – how to move your files

Many organisations now move to use the Google office suite for their day-to-day office needs,
this includes the Google sites service which allows you to easily create internal portals for the different
organisation’s departments.

This move allows for a department to share an internal web site that has easy access from home as well with the regular office google account,
it also allows for better collaboration with other branches of the same company located far away – as it saves the need for an office VPN, or the need to connect to a server that is located in a branch in another country,
instead – everybody just connect to Google.

But what do we do if our files are already on the office internal SharePoint?

apparently – the migration processes from SharePoint to Google sites is not as hard ,
here are two working options.

Continue reading SharePoint to Google sites — how to move your files

Technorati Tags: , ,

Great Online Stop Watch

This Online tool can be found here:

A very Easy to use online stop watch for all your IT needs, including:

  • limiting meeting sections (lets not talk about this subject more than 10 minutes)
  • counting time to measure a time limited action (how much time it really took the switch to reboot)
  • testing to see if an IT action was able to finish within the time limit set (DB switch should be completed in 5 minutes)

etc …

it has 2 useful modes:

  • Stop Watch
  • counter

both look like this:

but you setup the counter with this preliminary screen:



 

Solaris 10 Service Management

solaris 10

Under the Solaris 10 system – or the open Solaris as well,
the service management have been upgraded, and there are great new tools to handle the sysadmin
work on the services.

The long detailed explanation can be found here:
Solaris Service Management Facility – Quickstart Guide

But for the fast paced sysadmin – here is the short version :)

Continue reading Solaris 10 Service Management