Operating System - Linux
1753521 Members
4895 Online
108795 Solutions
New Discussion юеВ

Re: custom package control script

 

custom package control script

Hi all!

I am trying to write a package control script for LDAP service. I have defined a service ldap.daemon in ldap.sh using

SERVICE_NAME[0]="ldap.daemon"
SERVICE_CMD[0]="/usr/sbin/slapd -f /mnt/ldap/conf/slapd.conf"
SERVICE_RESTART[0]=""

But my package halts immediately (though slapd daemon still running):

###### Node "a.b.c.hu": Starting package at Thu Jun 2 10:23:59 CEST 2005 ######
Jun 2 10:23:59 - Node "a.b.c.hu": Activating volume group vgldap .
Jun 2 10:23:59 - Node "a.b.c.hu": Checking filesystems:
/dev/vgldap/lvol1
e2fsck 1.32 (09-Nov-2002)
/dev/vgldap/lvol1: clean, 28/122880 files, 9117/245760 blocks
Jun 2 10:23:59 - Node "a.b.c.hu": Mounting /dev/vgldap/lvol1 at /mnt/ldap
Jun 2 10:23:59 - Node "a.b.c.hu": Adding IP address xx.xx.xx.xx to subnet xx.xx.xx.xx
Jun 2 10:23:59 - Node "a.b.c.hu": Starting service ldap.daemon using
"/usr/sbin/slapd -f /mnt/ldap/conf/slapd.conf"
###### Node "a.b.c.hu": Package start completed at Thu Jun 2 10:23:59 CEST 2005 ######

####### Node "a.b.c.hu": Halting package at Thu Jun 2 10:23:59 CEST 2005 #######
Jun 2 10:23:59 - Node "a.b.c.hu": Halting service ldap.daemon
cmhaltserv : Service name ldap.daemon is not running.
Jun 2 10:23:59 - Node "a.b.c.hu": Remove IP address xx.xx.xx.xx from subnet xx.xx.xx.xx
Jun 2 10:23:59 - Node "a.b.c.hu": Unmounting filesystem on /mnt/ldap
Jun 2 10:23:59 - Node "a.b.c.hu": Deactivating volume group vgldap
###### Node "a.b.c.hu": Package halt completed at Thu Jun 2 10:23:59 CEST 2005 ######

Why does my package fails?

Krisztian
3 REPLIES 3
melvyn burnard
Honored Contributor

Re: custom package control script

Firstly, a daemon should never be used as a SERVICE in a package.
Secondly, if you are trying to run LDAP as the application, then this should be started in the customer defined run functions. If you wish to monitor the fact that the daemon is running using a service, then create a shell script that checks the process is still there every x seconds.

And a last comment, many people have been helping you on many questions, but you do not seem to be eager to assign points.
Please consider assigning points to those who take the time to help you in these forums.
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!

Re: custom package control script

You are right. I just found offending to assign low points for the answers did not really help. But I'll do my best.

Re: custom package control script

My solution (pkg.sh):

function customer_defined_run_cmds
{
# ADD customer defined run commands.
: # do nothing instruction, because a function must contain some command.

/usr/sbin/slapd -f /mnt/ldap/conf/slapd.conf -h ldap://example.com/
test_return 51
}

function customer_defined_halt_cmds
{
# ADD customer defined halt commands.
: # do nothing instruction, because a function must contain some command.

kill $(cat /var/run/slapd.pid)
test_return 52
}

I created a monitor script (attached to this post in the hope that it might be useful for someone). It is a modification of hasmb.mon.