Supervisor: A Process Control System

For these days I had the possibility to work with a great tool in my job. This tool allows us to monitor and control a number of processes on Unix operating systems.

As their website says: “Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.“.

Supervisor is written in Python and based on a configuration file (supervisord.conf) the daemon (supervisord) keeps monitoring for defined processes are running, and if the process is killed by whatever cause the supervisord start it again.

A configuration file looks like:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[supervisord]
logfile=/var/log/supervisord.log

[unix_http_server]
file=/tmp/supervisor.sock
username=supervisor
password=mysecret

[rpcinterface:supervisor]
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface

[inet_http_server]
port=*:5858
username=supervisor
password=mysecret

// Programs
[program:email_sender]
command=/usr/bin/php email_sender.php --arg1=a --arg2=b
user=www-data
autorestart=true
stderr_logfile=/var/log/email_sender_%(process_num)1d.err.log
stdout_logfile=/var/log/email_sender_%(process_num)1d.out.log
numprocs=2
process_name=%(program_name)s_%(process_num)02d

And a web app shows us a status of processes:

supervisor-screenshot

For more information you can read the documentation.

Transparent PNGs in Internet Explorer 6

Easy fix for the transparent png issue in IE.

It’s true that I’ve decided to do not bother me to make the things work for Internet Explorer 6 and/or lower, always there is the need to attend client’s requests for the worst web browser ever. In this case, to to the problem witn transparency in PNG images.

To fix this bug we should download this file. After uncompress it we should include the iepngfix.htc and blank.gif files in your web server, then edit the iepngfix.htc file to indicate where you uploaded the blank.gif file. Also, we can read the iepngfix.html page to check how to use it ;-).

With this tool we can fix both the images in and the background images used with CSS; to do that we should add the below line in our css:

1
behavior: url(iepngfix.htc);

Keep on mind to set the right url to the iepngfix.htc file.

If we wish to make the tag to respect the transparent background in IE, we should add:

1
2
3
img{
  behavior: url(iepngfix.htc);
}

If we have a css element with a background image, we should add the behavior to it, for instance if we have a class named .logo, we should add:

1
2
3
4
.logo{
  background: url(images/logo.png) no-repeat left top;
  behavior: url(iepngfix.htc);
}

Well, that’s it! 🙂