Archive for July, 2007

eTicketStats add on soon to be included in the Opensource eTicket Help Desk system

Friday, July 27th, 2007

I’m happy to report that the add-on I wrote for the opensource eTicket Helpdesk system is soon be included in the main distribution.

The eTicketStats add-on provides info and graphs and charts of the number of tickets submitted/closed per month, per week, tickets per category, ticket response/closing time etc.

Create a Staff Directory webpage using PHP and LDAP

Wednesday, July 25th, 2007

Here’s the scenario:

We use LDAP to store the information on staff such as names, usernames, email addresses, telephone numbers, photos, passwords etc.

We want a webpage the displays up to date details off all the staff in our organisation. We would like to dynamically extract the information about the staff from our existing LDAP database and present it as a webpage on our intranet.

1. Download the scripts I’ve written here and extract them to a directory on your Intranet server or somewhere suitable.

EG. http://intranet/StaffDirectory/

2. Configure the script.

Enter you LDAP hostname and distinguished name.
Users have previously created using the inetOrgPerson LDAP object Class. This gives us attributes to use such as displayName, mail, telephoneNumber and jpegPhoto.

We enter the LDAP atrributes we wish to extract into the $params array below.

$ip = “your_ldap_hostname”;
$dn = “dc=example,dc=org”;
$params = array( “displayName”, “mail”, “telephoneNumber”, “jpegPhoto”);

3. Browse to http://intranet/StaffDirectory/index.php to view all the the details of you staff members.

Google gets lost on the way to Ireland, ending up in Germany!

Tuesday, July 24th, 2007

When I browse to www.google.com I am redirected to www.google.de.

I’m in Ireland.

Not Germany.

Google,
Ich mochte de Irish Seite bitte.

Danke

Auf Wiedersehen

Great links for designers and developers

Friday, July 20th, 2007

Search thousands of icons
http://www.iconfinder.net/

Create those diagonal stripe patterns that are ’so hot right now’.
http://www.stripegenerator.com/
http://www.tartanmaker.com/

Upload images to see how they appear to colour-blind users.
http://www.vischeck.com/

Generate a favicon for your web page.
http://tools.dynamicdrive.com/favicon/

Thanks to the UI group at the TSSG for tipping me off to some of these links.

Technorati Tags:

SMF support for Apache on Solaris

Wednesday, July 18th, 2007

Good tutorial on this topic here: http://blogs.sun.com/shanti/entry/smf_support_for_apache_in

Activating technorati blog claim

Thursday, July 12th, 2007

Technorati Profile

Cloning Solaris Zone tutorial

Thursday, July 12th, 2007

James over at mernin.com has posted a bunch of excellent Solaris tutorials. The latest is on Cloning a Solaris Zone could prove useful to the Solaris articles I’ve posted here.

Nice one James!

Solution to the Wordpress + Chrooteded Apache + email notification problem

Wednesday, July 11th, 2007

If you are running Wordpress on a chrooted Apache you may find that the email notification facility in Wordpress no longer works.

Why is this? Wordpress uses the sendmail binary to send those emails. When Apache is chrooted that sendmail software is not longer visible. Hence it fails.

This becomes a problem when you first install Wordpress because Wordpress fails to email the blog username and password to you. Wordpress is installed but you can’t log in.

In this scenario you will need to to reset the admin password via mysql with this method.

You can then log in and use the blog but unfortunately since the email notification does not work you will not know if comments are left unless you check manually.

Solution

Install the wp-phpmailer plugin for Wordpress to enable Wordpress to send email via SMTP instead fo the sendmail.

Sorted!

Addthis button

Tuesday, July 10th, 2007

What social bookmarking services should you use for your blog?

There are plenty to choose from…

  Del.icio.us   Google
Bookmarks
 
  Digg   Furl  
  Reddit   Newsvine  
 
My Browser
  Yahoo
MyWeb
 
  StumbleUpon   Technorati  
  Ask   Live
Bookmarks
 
  Simpy   Blogmarks  
  Facebook   Netscape  
  Slashdot   Fark  
  Backflip   Wink  
  Spurl   LinkaGoGo  
  Mister
Wong
  Feed
Me Links
 
  Netvouz   Magnolia  
  Diigo   Blue
Dot
 
  Segnalo   Tailrank  
  RawSugar   BlinkList  
  Shadows   Suggest a Service

Why not use all of them with www.addthis.com.

Sign up and you’ll get instructions on how to insert the addthis.com button to your posts to make all of the above services available through one button.

SMF support for MySQL in Cool Stack

Wednesday, July 4th, 2007

The post derives heavily from Shanti’s Sun Micro Systems blog.

For a succinct explanation from www.oreillynet.com .

SMF try this from or Solaris 10, Sun introduced the Service Management Facility. SMF is a framework that handles system boot-up, process management, and self-healing. It addresses the shortcomings of startup scripts and creates an infrastructure to manage daemons after the host has booted.

The following steps are required to add MySQL as a service into Solaris SMF. We added the 32-bit version on MySQL that comes with the Cool Stack CSKAmp package.

 

Create the manifest

A service needs a file called a manifest.  A service manifest describes the service and its management needs. It lists the service dependencies, the control scripts, and the actions to take when the service fails. The manifest starts out as an XML file that SMF imports into a central repository, which records the properties of all the services.

Create a file named /var/svc/manifest/network/cskmysql.xml with the following contents :

 <?xml version=’1.0′?>
 <!DOCTYPE service_bundle SYSTEM ‘/usr/share/lib/xml/dtd/service_bundle.dtd.1′>
<!–
    Copyright 2006,2007 Sun Microsystems, Inc.  All rights reserved.
    Manifest for CSKmysql - should reside in /var/svc/manifest/network
–>

<service_bundle type=’manifest’ name=’CSKmysql:mysql’>
<service
        name=’network/csk-mysql’
        type=’service’
        version=’1′>
        <create_default_instance enabled=’false’ />
        <single_instance />

       <!–
         Wait for network interfaces to be initialized.
        –>
       <dependency name=’network’
           grouping=’require_all’
           restart_on=’error’
           type=’service’>
           <service_fmri  
           value=’svc:/milestone/network:default’/>
        </dependency>

        <!–
          Wait for all local filesystems to be mounted.
        –>
        <dependency name=’filesystem-local’
            grouping=’require_all’
            restart_on=’none’
            type=’service’>
            <service_fmri
               value=’svc:/system/filesystem/local:default’/>
         </dependency>

         <exec_method
             type=’method’
             name=’start’
             exec=’/opt/coolstack/lib/svc/method/svc-cskmysql start’
             timeout_seconds=’60′>
             <method_context
working_directory=’/opt/coolstack’>
                 <method_credential
                   user=’mysql’ group=’mysql’
                   privileges=’basic,!proc_session,!proc_info,!file_link_any,net_privaddr’ />
             </method_context>
         </exec_method>

         <exec_method
             type=’method’
             name=’stop’
             exec=’/opt/coolstack/lib/svc/method/svc-cskmysql stop’
             timeout_seconds=’60′>
             <method_context />
         </exec_method>

         <exec_method
             type=’method’
             name=’refresh’
             exec=’/opt/coolstack/lib/svc/method/svc-cskmysql restart’
             timeout_seconds=’60′>
             <method_context working_directory=’/opt/coolstack’>
                 <method_credential
                   user=’mysql’ group=’mysql’
                   privileges=’basic,!proc_session,!proc_info,!file_link_any,net_privaddr’ />
             </method_context>
         </exec_method>

 </service>
 </service_bundle>

 

Create the method

Create the file /opt/coolstack/lib/svc/method/svc-cskmysql referenced in the manifest with the following contents and make it executable. You may have to create the directories below /opt/coolstack/lib first. This file needs to be edited to set DB_DIR to the path of your data directory (where data files reside), and MYSQL_DIR if you are usi
ng the 64-bit MySQL version.
Create the file /opt/coolstack/lib/svc/method/svc-cskmysql.

You will also have to manually create directories if they don’t already exist.

/opt/coolstack/lib
/opt/coolstack/lib/svc
/opt/coolstack/lib/method

This file needs to be edited to set DB_DIR to the path of your data directory ( normally /opt/coolstack/mysql_32bit), and MYSQL_DIR if you are using the 64-bit MySQL version.
Copy and past the following into the file named above. It assumes the paths of the  default installation of Cool Stack. If you have changed the paths you’ll need to reflect those changes here.

 

#!/usr/bin/sh
#
#   Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
#        Method file for CSKMySQL
#
# This uses the MySQL packages from CoolStack 1.1 (CSKmysql)
# If you’re using the 32bit mysql from CSKamp, change MYSQL_DIR below to mysql_32bit.
# This file should reside in /opt/coolstack/lib/svc/method
#
# NOTE: Make sure DB_DIR is owned BY the mysql user and group and chmod 700
#

. /lib/svc/share/smf_include.sh

DB_DIR=/data
PIDFILE=${DB_DIR}/`/usr/bin/uname -n`.pid
MYSQL_DIR=/opt/coolstack/mysql_32bit

mysql_stop () {
        if [ -f ${PIDFILE} ]; then
            /usr/bin/pkill mysqld_safe >/dev/null 2>&1
            /usr/bin/kill `cat ${PIDFILE}` > /dev/null 2>&1 && echo -n ‘ mysqld’
        fi
}

mysql_start () {
        $MYSQL_DIR/bin/mysqld_safe –user=mysql –datadir=${DB_DIR} –pid-file=${PIDFILE} > /dev/null &
}

##
# Start of script
#
case "$1" in
    start)
        mysql_start
        ;;
    stop)
        mysql_stop
        ;;
    restart)
        mysql_stop
        while pgrep mysqld > /dev/null
        do
            sleep 1
        done
        mysql_start
        ;;
    *)
        echo ""
        echo "Usage: `basename $0` { start | stop | restart }"
        echo ""
        exit 64
        ;;
esac

 

Change file ownership  

Ensure that the MySQL user and group exist and this user owns $DB_DIR. It’s also a good idea to chmod 0700 all files in $DB_DIR.

Cool Stack MySQL runs as user:group mysql:mysql.

 # cd /opt/coolstack/ /mysql_32bit
# chown -R mysql ./data
# chgrp -R mysql ./data
# Chmod –R 077 ./data

Start the csk-mysql service
Import the new MySQL config :

# svccfg -v import /var/svc/manifest/network/cskmysql.xml

Start MySQL as a  service::

# svcadm -v enable csk-mysql

A log file available at /var/svc/log/network-csk-mysql:CSKmysql.log file.
More detailed information for troubleshooting startup failures can be obtained from the command svcs -x.

If the services does not start and/or goes into maintenance mode then you will need to go through the steps above again verifying it’s correct. I initially had a problem due to incorrect privileges on  /opt/coolstack.mysql_32bit/data.  
More information on SMF can be found at  http://www.sun.com/bigadmin/content/selfheal/smf-quickstart.html