flexlm: Added support for running lmgrd servers.

This commit is contained in:
Timo Mkinen 2013-05-07 16:52:51 +03:00
parent 9769a06eff
commit de46a6c4a4
3 changed files with 230 additions and 3 deletions

View file

@ -4,8 +4,10 @@ VERSION = 11.11.1.1
BASEURL = http://www.globes.com/products/utilities/v$(VERSION)/ BASEURL = http://www.globes.com/products/utilities/v$(VERSION)/
all: manifest download all: manifest download
download: $(PACKAGES)/lmutil-${VERSION}.i386.Linux \ download: $(PACKAGES)/lmutil-$(VERSION).i386.Linux \
$(PACKAGES)/lmutil-${VERSION}.x86_64.Linux $(PACKAGES)/lmgrd-$(VERSION).i386.Linux \
$(PACKAGES)/lmutil-$(VERSION).x86_64.Linux \
$(PACKAGES)/lmgrd-$(VERSION).x86_64.Linux
manifest: $(MANIFESTS)/flexlm.pp manifest: $(MANIFESTS)/flexlm.pp
$(PACKAGES)/lmutil-$(VERSION).i386.Linux: $(PACKAGES)/lmutil-$(VERSION).i386.Linux:
@ -13,11 +15,22 @@ $(PACKAGES)/lmutil-$(VERSION).i386.Linux:
test -f $@ || curl $(BASEURL)/lmutil-i86_lsb-$(VERSION).tar.gz | \ test -f $@ || curl $(BASEURL)/lmutil-i86_lsb-$(VERSION).tar.gz | \
zcat | tar xf - -O > $@ zcat | tar xf - -O > $@
$(PACKAGES)/lmgrd-$(VERSION).i386.Linux:
@umask 022 ; echo $@; \
test -f $@ || curl $(BASEURL)/lmgrd-i86_lsb-$(VERSION).tar.gz | \
zcat | tar xf - -O > $@
$(PACKAGES)/lmutil-$(VERSION).x86_64.Linux: $(PACKAGES)/lmutil-$(VERSION).x86_64.Linux:
@umask 022 ; echo $@; \ @umask 022 ; echo $@; \
test -f $@ || curl $(BASEURL)/lmutil-x64_lsb-$(VERSION).tar.gz | \ test -f $@ || curl $(BASEURL)/lmutil-x64_lsb-$(VERSION).tar.gz | \
zcat | tar xf - -O > $@ zcat | tar xf - -O > $@
$(PACKAGES)/lmgrd-$(VERSION).x86_64.Linux:
@umask 022 ; echo $@; \
test -f $@ || curl $(BASEURL)/lmgrd-x64_lsb-$(VERSION).tar.gz | \
zcat | tar xf - -O > $@
$(MANIFESTS)/flexlm.pp: download $(MANIFESTS)/flexlm.pp: download
@umask 022 ; echo $@; \ @umask 022 ; echo $@; \
echo '$$lmutil_package_latest = "$(VERSION)"' > $@ echo '$$lmutil_package_latest = "$(VERSION)"' > $@ ; \
echo '$$lmgrd_package_latest = "$(VERSION)"' >> $@

82
flexlm/files/lmgrd.init Normal file
View file

@ -0,0 +1,82 @@
#!/bin/bash
#
# lmgrd Starts lmgrd license daemon.
#
# chkconfig: - 99 01
# description: Flexnet license manager daemon.
# Source function library.
. /etc/init.d/functions
PATH=${PATH}:/usr/local/lib/lmgrd
# Determine license id
licid=`basename $0 | cut -d '.' -f 2-`
if [ -z ${licid} ]; then
licid=`hostname -s`
fi
logdir="/var/log/lmgrd/${licid}"
logfile="${logdir}/lmgrd.${licid}.`date '+%Y%m%d-%H%M%S'`.log"
licfile="/etc/lmgrd/license.${licid}"
lockfile="/var/lock/lmgrd.${licid}"
start() {
touch ${logfile}
chown licensed:root ${logfile}
chmod 640 ${logfile}
echo -n $"Starting lmgrd (${licid}): "
su - licensed -s /bin/sh -c "lmgrd -l ${logfile} -x lmdown -2 -p -c ${licfile}"
RETVAL=$?
if [ ${RETVAL} -eq 0 ]; then
lmstat -c ${licfile} > /dev/null 2>&1
RETVAL=$?
fi
if [ ${RETVAL} -eq 0 ]; then
echo_success
touch ${lockfile}
else
echo_failure
fi
echo
return ${RETVAL}
}
stop() {
echo -n $"Shutting down lmgrd (${licid}): "
pkill -u licensed -f "${logdir}/lmgrd.${licid}"
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo_success
rm -f $lockfile
else
echo_failure
fi
echo
return ${RETVAL}
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
lmstat -c ${licfile}
;;
restart)
stop
start
;;
reload)
lmreread -c ${licfile}
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|reload|status}"
exit 2
;;
esac
exit $?

View file

@ -34,3 +34,135 @@ class flexlm::client {
} }
} }
# Install common files from FlexLM license server
#
class flexlm::lmgrd::common {
require flexlm::client
include user::system
realize([ User["licensed"], Group["licensed"], ])
file { "/usr/local/sbin/lmgrd":
ensure => present,
source => "puppet:///files/packages/lmgrd-${lmgrd_package_latest}.${::architecture}.${::kernel}",
mode => "0755",
owner => "root",
group => "root",
}
file { [ "/etc/lmgrd", "/usr/local/lib/lmgrd", "/var/log/lmgrd", ]:
ensure => directory,
mode => "0755",
owner => "root",
group => "root",
}
}
# Install new instance of lmgrd
#
# === Parameters
#
# $name:
# Instance name.
# $license:
# Source path for license file.
# $vendors:
# Array containing vendor daemon names to be installed. They are
# installed under /usr/local/lib/lmgrd from:
# puppet:///files/lmgrd/$name
#
# === Sample usage
#
# flexlm::lmgrd { "matlab":
# license => "puppet:///files/lmgrd/license.matlab",
# vendors => [ "lm_matlab", ],
# }
#
define flexlm::lmgrd($license, $vendors=[]) {
require flexlm::lmgrd::common
if ! ($::operatingsystem in ["CentOS","RedHat"]) {
fail("flexlm::lmgrd not supported in ${::operatingsystem}")
}
file { "/etc/lmgrd/license.${name}":
ensure => present,
source => $license,
mode => "0644",
owner => "root",
group => "root",
notify => Service["lmgrd.${name}"],
}
file { "/var/log/lmgrd/${name}":
ensure => directory,
mode => "0750",
owner => "root",
group => "licensed",
before => Service["lmgrd.${name}"],
}
flexlm::vendor { $vendors: }
file { "/etc/init.d/lmgrd.${name}":
ensure => present,
source => "puppet:///modules/flexlm/lmgrd.init",
mode => "0755",
owner => "root",
group => "root",
notify => Exec["chkconfig --add lmgrd.${name}"],
}
exec { "chkconfig --add lmgrd.${name}":
user => "root",
path => "/bin:/usr/bin:/sbin:/usr/sbin",
refreshonly => true,
before => Service["lmgrd.${name}"],
}
service { "lmgrd.${name}":
ensure => running,
enable => true,
hasstatus => true,
}
}
# Install vendor daemon binary
#
# === Parameters:
#
# $name:
# Vendor daemon name.
# $source:
# Source path where daemon is found. Defaults to
# puppet:///files/lmgrd/${name}.
#
# === Sample usage:
#
# flexlm::lmgrd::vendor { "lm_matlab":
# source => "puppet:///files/lmgrd/lm_matlab",
# }
#
define flexlm::lmgrd::vendor($source=undef) {
if !$source {
$source = "puppet:///files/lmgrd/${name}"
}
file { "/usr/local/lib/lmgrd/${name}":
ensure => present,
source => $source,
mode => "0755",
owner => "root",
group => "root",
require => File["/usr/local/lib/lmgrd"],
}
}