Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • DM/dm-docs
  • hammonds/dm-docs
  • hparraga/dm-docs
3 results
Show changes
Showing
with 1791 additions and 0 deletions
[WebService]
serviceHost=0.0.0.0
servicePort=44436
sslCertFile=DM_INSTALL_DIR/etc/ssl/cat-web-service.crt
sslKeyFile=DM_INSTALL_DIR/etc/ssl/cat-web-service.key
sslCaCertFile=DM_INSTALL_DIR/etc/ssl/cacert.pem
stationName=DM_STATION_NAME
[AuthorizationPrincipalManager]
principalRetriever=dm.ds_web_service.service.auth.dsAuthPrincipalRetriever.DsAuthPrincipalRetriever()
#principalRetriever=DbPrincipalRetriever()
#principalRetriever=NoOpPrincipalRetriever()
principalAuthenticator1=CryptedPasswordPrincipalAuthenticator()
principalAuthenticator2=LdapPasswordPrincipalAuthenticator(serverUrl='ldaps://phoebusldap.aps.anl.gov:636', dnFormat='uid=%s,ou=people,o=aps.anl.gov,dc=aps,dc=anl,dc=gov')
[MongoDbManager]
mongoDbName=dm
mongoDbUri=mongodb://localhost:27017
mongoDbUser=dm
mongoDbPasswordFile=DM_INSTALL_DIR/etc/dm.db.passwd
[DsRestApiFactory]
username=DM_SYSTEM_USER
passwordFile=DM_INSTALL_DIR/etc/DM_SYSTEM_USER.system.passwd
host=DM_DS_WEB_SERVICE_HOST
port=DM_DS_WEB_SERVICE_PORT
protocol=DM_WEB_SERVICE_PROTOCOL
# Available logger levels: debug, info, warn, error, critical
[ConsoleLogging]
handler=ConsoleLoggingHandler(sys.stdout,)
level=debug
format=%(asctime)s,%(msecs)003d %(levelname)s %(filename)s:%(lineno)d %(process)d: %(message)s
dateFormat=%Y/%m/%d %H:%M:%S
[FileLogging]
handler=TimedRotatingFileLoggingHandler('DM_INSTALL_DIR/var/log/cat-web-service.log')
level=debug
format=%(asctime)s,%(msecs)003d %(levelname)s %(filename)s:%(lineno)d %(process)d: %(message)s
dateFormat=%Y/%m/%d %H:%M:%S
[WebService]
serviceHost=0.0.0.0
servicePort=33336
sslCertFile=DM_INSTALL_DIR/etc/ssl/daq-web-service.crt
sslKeyFile=DM_INSTALL_DIR/etc/ssl/daq-web-service.key
sslCaCertFile=DM_INSTALL_DIR/etc/ssl/cacert.pem
stationName=DM_STATION_NAME
[AuthorizationPrincipalManager]
principalRetriever=dm.ds_web_service.service.auth.dsAuthPrincipalRetriever.DsAuthPrincipalRetriever()
#principalRetriever=DbPrincipalRetriever()
#principalRetriever=NoOpPrincipalRetriever()
principalAuthenticator1=CryptedPasswordPrincipalAuthenticator()
principalAuthenticator2=LdapPasswordPrincipalAuthenticator(serverUrl='ldaps://phoebusldap.aps.anl.gov:636', dnFormat='uid=%s,ou=people,o=aps.anl.gov,dc=aps,dc=anl,dc=gov')
#[SingleSignOnManager]
#sessionManager=dm.ds_web_service.service.auth.dsSessionManager.DsSessionManager()
#sessionTimeoutInSeconds=3600
[FileSystemObserver]
# Minimum file processing delay since last update
minFileProcessingDelayInSeconds=10
fileSystemEventTimeoutInSeconds=10
fileSystemObserverAgent=dm.daq_web_service.service.impl.watchdogFileSystemObserverAgent.WatchdogFileSystemObserverAgent()
#fileSystemObserverAgent=dm.daq_web_service.service.impl.ftpFileSystemObserverAgent.FtpFileSystemObserverAgent('dmdaq', 2811)
[FileProcessingManager]
numberOfProcessingThreads=5
defaultNumberOfRetries=3
defaultRetryWaitPeriodInSeconds=60
fileProcessor1=dm.common.processing.plugins.rsyncFileTransferPlugin.RsyncFileTransferPlugin(localMd5Sum=True,remoteMd5Sum=False,deleteOriginal=False)
#fileProcessor1=dm.common.processing.plugins.gridftpFileTransferPlugin.GridftpFileTransferPlugin()
#fileProcessor2=dm.common.processing.plugins.rsyncFileTransferPlugin.RsyncFileTransferPlugin(dest=\ffdfdsf')
fileProcessor2=dm.common.processing.plugins.mongoDbFileCatalogPlugin.MongoDbFileCatalogPlugin()
fileProcessor3=dm.daq_web_service.service.impl.dsProcessFileNotificationPlugin.DsProcessFileNotificationPlugin()
[DsRestApiFactory]
username=DM_SYSTEM_USER
passwordFile=DM_INSTALL_DIR/etc/DM_SYSTEM_USER.system.passwd
host=DM_DS_WEB_SERVICE_HOST
port=DM_DS_WEB_SERVICE_PORT
protocol=DM_WEB_SERVICE_PROTOCOL
[MongoDbManager]
mongoDbName=dm
mongoDbUri=mongodb://localhost:27017
mongoDbUser=dm
mongoDbPasswordFile=/home/dm/etc/dm.db.passwd
# Available logger levels: debug, info, warn, error, critical
[ConsoleLogging]
handler=ConsoleLoggingHandler(sys.stdout,)
level=debug
format=%(asctime)s,%(msecs)003d %(levelname)s %(filename)s:%(lineno)d %(process)d: %(message)s
dateFormat=%Y/%m/%d %H:%M:%S
[FileLogging]
handler=TimedRotatingFileLoggingHandler('DM_INSTALL_DIR/var/log/daq-web-service.log')
level=debug
format=%(asctime)s,%(msecs)003d %(levelname)s %(filename)s:%(lineno)d %(process)d: %(message)s
dateFormat=%Y/%m/%d %H:%M:%S
DM_DB_NAME=dm
DM_DB_USER=dm
DM_DB_HOST=127.0.0.1
DM_DB_PORT=11136
DM_DB_ADMIN_USER=postgres
DM_DB_ADMIN_HOSTS="127.0.0.1"
DM_DB_SCRIPTS_DIR=
DM_SYSTEM_USER=dm
DM_STORAGE_DIR=
DM_CONTEXT_ROOT=dm
DM_WEB_SERVICE_PROTOCOL=https
DM_DS_WEB_SERVICE_HOST=DM_HOSTNAME
DM_DS_WEB_SERVICE_PORT=22236
DM_DAQ_WEB_SERVICE_HOST=DM_HOSTNAME
DM_DAQ_WEB_SERVICE_PORT=33336
DM_CAT_WEB_SERVICE_HOST=DM_HOSTNAME
DM_CAT_WEB_SERVICE_PORT=44436
DM_PROC_WEB_SERVICE_HOST=DM_HOSTNAME
DM_PROC_WEB_SERVICE_PORT=55536
DM_SOFTWARE_VERSION="1.1 (DM_DATE)"
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#
# This definition stops the following lines choking if HOME isn't
# defined.
HOME = .
RANDFILE = $ENV::HOME/.rnd
# Uncomment out to enable OpenSSL configuration see config(3)
# openssl_conf = openssl_init
# To use this configuration file with the "-extfile" option of the
# "openssl x509" utility, name here the section containing the
# X.509v3 extensions to use:
# extensions =
# (Alternatively, use a configuration file that has only
# X.509v3 extensions in its main [= default] section.)
[openssl_init]
# Extra OBJECT IDENTIFIER info:
oid_section = new_oids
alg_section = algs
[ new_oids ]
# We can add new OIDs in here for use by any config aware application
# Add a simple OID like this:
# shortname=Long Object Identifier Name, 1.2.3.4
# Or use config file substitution like this:
# testoid2=OID2 LONG NAME, ${testoid1}.5.6, OTHER OID
[ algs ]
# Algorithm configuration options. Currently just fips_mode
fips_mode = no
####################################################################
[ ca ]
default_ca = CA_default # The default ca section
####################################################################
[ CA_default ]
dir = $ENV::DM_INSTALL_DIR/etc/CA # Where everything is kept
certs = $dir/certs # Where the issued certs are kept
crl_dir = $dir/crl # Where the issued crl are kept
database = $dir/index.txt # database index file.
#unique_subject = no # Set to 'no' to allow creation of
# several ctificates with same subject.
new_certs_dir = $dir/newcerts # default place for new certs.
certificate = $dir/cacert.pem # The CA certificate
serial = $dir/serial # The current serial number
crlnumber = $dir/crlnumber # the current crl number
# must be commented out to leave a V1 CRL
crl = $dir/crl.pem # The current CRL
private_key = $dir/private/cakey.pem# The private key
RANDFILE = $dir/private/.rand # private random number file
x509_extensions = usr_cert # The extentions to add to the cert
# Comment out the following two lines for the "traditional"
# (and highly broken) format.
name_opt = ca_default # Subject Name options
cert_opt = ca_default # Certificate field options
# Extension copying option: use with caution.
# copy_extensions = copy
# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
# so this is commented out by default to leave a V1 CRL.
# crlnumber must also be commented out to leave a V1 CRL.
# crl_extensions = crl_ext
default_days = 3650 # how long to certify for
default_crl_days= 30 # how long before next CRL
default_md = sha512 # which md to use.
preserve = no # keep passed DN ordering
# A few difference way of specifying how similar the request should look
# For type CA, the listed attributes must be the same, and the optional
# and supplied fields are just that :-)
policy = policy_match
# For the CA policy
[ policy_match ]
countryName = match
stateOrProvinceName = optional
organizationName = match
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
# For the 'anything' policy
# At this point in time, you must list all acceptable 'object'
# types.
[ policy_anything ]
countryName = optional
#stateOrProvinceName = optional
#localityName = optional
organizationName = optional
#organizationalUnitName = optional
commonName = supplied
emailAddress = optional
####################################################################
[ req ]
default_bits = 2048
default_md = sha512
default_keyfile = privkey.pem
distinguished_name = req_distinguished_name
attributes = req_attributes
x509_extensions = v3_ca # The extentions to add to the self signed cert
# Passwords for private keys if not present they will be prompted for
# input_password = secret
# output_password = secret
# This sets a mask for permitted string types. There are several options.
# default: PrintableString, T61String, BMPString.
# pkix : PrintableString, BMPString.
# utf8only: only UTF8Strings.
# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
# MASK:XXXX a literal mask value.
# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
# so use this option with caution!
# we use PrintableString+UTF8String mask so if pure ASCII texts are used
# the resulting certificates are compatible with Netscape
string_mask = MASK:0x2002
# req_extensions = v3_req # The extensions to add to a certificate request
[ req_distinguished_name ]
countryName = Country Name (2 letter code)
countryName_default = US
countryName_min = 2
countryName_max = 2
#stateOrProvinceName = State or Province Name (full name)
#stateOrProvinceName_default =
#localityName = Locality Name (eg, city)
#localityName_default =
0.organizationName = Organization Name (eg, company)
0.organizationName_default = Argonne National Laboratory
# we can do this but it is not needed normally :-)
1.organizationName = Second Organization Name (eg, company)
1.organizationName_default = Advanced Photon Source
organizationalUnitName = Organizational Unit Name (eg, section)
organizationalUnitName_default = AES/SSG
commonName = Common Name (eg, your name or your server\'s hostname)
commonName_max = 64
emailAddress = Email Address
emailAddress_max = 64
# SET-ex3 = SET extension number 3
[ req_attributes ]
challengePassword = A challenge password
challengePassword_min = 4
challengePassword_max = 20
unstructuredName = An optional company name
[ usr_cert ]
# These extensions are added when 'ca' signs a request.
# This goes against PKIX guidelines but some CAs do it and some software
# requires this to avoid interpreting an end user certificate as a CA.
basicConstraints=CA:FALSE
# Here are some examples of the usage of nsCertType. If it is omitted
# the certificate can be used for anything *except* object signing.
# This is OK for an SSL server.
# nsCertType = server
# For an object signing certificate this would be used.
# nsCertType = objsign
# For normal client use this is typical
# nsCertType = client, email
# and for everything including object signing:
# nsCertType = client, email, objsign
# This is typical in keyUsage for a client certificate.
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
# This will be displayed in Netscape's comment listbox.
nsComment = "OpenSSL Generated Certificate"
# PKIX recommendations harmless if included in all certificates.
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer
# This stuff is for subjectAltName and issuerAltname.
# Import the email address.
# subjectAltName=email:copy
# An alternative to produce certificates that aren't
# deprecated according to PKIX.
# subjectAltName=email:move
# Copy subject details
# issuerAltName=issuer:copy
#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
#nsBaseUrl
#nsRevocationUrl
#nsRenewalUrl
#nsCaPolicyUrl
#nsSslServerName
[ server ]
basicConstraints=CA:FALSE
nsCertType = server
nsComment = "OpenSSL Generated Server Certificate"
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer:always
[ v3_req ]
# Extensions to add to a certificate request
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
[ v3_ca ]
# Extensions for a typical CA
# PKIX recommendation.
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid:always,issuer:always
# This is what PKIX recommends but some broken software chokes on critical
# extensions.
basicConstraints = critical,CA:true
# So we do this instead.
#basicConstraints = CA:true
# Key usage: this is typical for a CA certificate. However since it will
# prevent it being used as an test self-signed certificate it is best
# left out by default.
# keyUsage = cRLSign, keyCertSign
# Some might want this also
# nsCertType = sslCA, emailCA
# Include email address in subject alt name: another PKIX recommendation
# subjectAltName=email:copy
# Copy issuer details
# issuerAltName=issuer:copy
# DER hex encoding of an extension: beware experts only!
# obj=DER:02:03
# Where 'obj' is a standard or added object
# You can even override a supported extension:
# basicConstraints= critical, DER:30:03:01:01:FF
[ crl_ext ]
# CRL extensions.
# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
# issuerAltName=issuer:copy
authorityKeyIdentifier=keyid:always,issuer:always
[ proxy_cert_ext ]
# These extensions should be added when creating a proxy certificate
# This goes against PKIX guidelines but some CAs do it and some software
# requires this to avoid interpreting an end user certificate as a CA.
basicConstraints=CA:FALSE
# Here are some examples of the usage of nsCertType. If it is omitted
# the certificate can be used for anything *except* object signing.
# This is OK for an SSL server.
# nsCertType = server
# For an object signing certificate this would be used.
# nsCertType = objsign
# For normal client use this is typical
# nsCertType = client, email
# and for everything including object signing:
# nsCertType = client, email, objsign
# This is typical in keyUsage for a client certificate.
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
# This will be displayed in Netscape's comment listbox.
nsComment = "OpenSSL Generated Certificate"
# PKIX recommendations harmless if included in all certificates.
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer:always
# This stuff is for subjectAltName and issuerAltname.
# Import the email address.
# subjectAltName=email:copy
# An alternative to produce certificates that aren't
# deprecated according to PKIX.
# subjectAltName=email:move
# Copy subject details
# issuerAltName=issuer:copy
#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
#nsBaseUrl
#nsRevocationUrl
#nsRenewalUrl
#nsCaPolicyUrl
#nsSslServerName
# This really needs to be in place for it to be a proxy certificate.
proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo
## DM user sudo functions
## All strings starting with DM_* have to be replaced with actual values
Host_Alias HOST=DM_HOSTNAME
User_Alias USER=DM_SYSTEM_UNIX_ACCOUNT
Cmnd_Alias SETFACL=/usr/bin/setfacl -m group\:*\:rx DM_STORAGE_DIR/*
Cmnd_Alias USERMOD=/usr/sbin/usermod -a -G * *
Cmnd_Alias GROUPADD=/usr/sbin/groupadd *
Cmnd_Alias CHOWN=/bin/chown \:* *
Cmnd_Alias CHOWN_R=/bin/chown -R \:* *
Cmnd_Alias GPASSWD=/usr/bin/gpasswd * * *
Cmnd_Alias NSCD=/usr/sbin/nscd -i *
USER HOST = (root) NOPASSWD: SETFACL,USERMOD,GROUPADD,CHOWN,CHOWN_R,GPASSWD,NSCD
DM_DB_NAME=dm_dev
DM_DB_USER=dm_dev
DM_DB_HOST=127.0.0.1
DM_DB_PORT=11136
DM_DB_ADMIN_USER=postgres
DM_DB_ADMIN_HOSTS="127.0.0.1"
DM_DB_SCRIPTS_DIR=
DM_SYSTEM_USER=dm
DM_STORAGE_DIR=
DM_CONTEXT_ROOT=dm_dev
DM_WEB_SERVICE_PROTOCOL=https
DM_DS_WEB_SERVICE_HOST=DM_HOSTNAME
DM_DS_WEB_SERVICE_PORT=22237
DM_DAQ_WEB_SERVICE_HOST=DM_HOSTNAME
DM_DAQ_WEB_SERVICE_PORT=33337
DM_CAT_WEB_SERVICE_HOST=DM_HOSTNAME
DM_CAT_WEB_SERVICE_PORT=44437
DM_PROC_WEB_SERVICE_HOST=DM_HOSTNAME
DM_PROC_WEB_SERVICE_PORT=55537
DM_SOFTWARE_VERSION="Development Snapshot (DM_DATE)"
[WebService]
serviceHost=0.0.0.0
servicePort=22236
sslCertFile=DM_INSTALL_DIR/etc/ssl/ds-web-service.crt
sslKeyFile=DM_INSTALL_DIR/etc/ssl/ds-web-service.key
sslCaCertFile=DM_INSTALL_DIR/etc/ssl/cacert.pem
[AuthorizationPrincipalManager]
principalRetriever=DbPrincipalRetriever()
#principalRetriever=NoOpPrincipalRetriever()
principalAuthenticator1=CryptedPasswordPrincipalAuthenticator()
principalAuthenticator2=LdapPasswordPrincipalAuthenticator(serverUrl='ldaps://dmid-vm.xray.aps.anl.gov:636', dnFormat='uid=%s,ou=people,o=aps.anl.gov,dc=aps,dc=anl,dc=gov')
[ExperimentManager]
storageDirectory=DM_STORAGE_DIR
storageId=extrepid
manageStoragePermissions=True
#platformUtility=dm.common.utility.linuxUtility.LinuxUtility()
platformUtility=dm.common.utility.ldapLinuxPlatformUtility.LdapLinuxPlatformUtility('ldaps://dmid-vm.xray.aps.anl.gov:636', 'uid=DM_SYSTEM_UNIX_ACCOUNT,ou=People,o=aps.anl.gov,dc=aps,dc=anl,dc=gov', 'DM_INSTALL_DIR/etc/DM_SYSTEM_UNIX_ACCOUNT.ldap.passwd', groupDnFormat='cn=%s,ou=DM,ou=Group,o=aps.anl.gov,dc=aps,dc=anl,dc=gov', minGidNumber=66000)
[LdapLinuxPlatformUtility]
refreshAuthFilesCommand=
[DbManager]
dbSchema=DM_DB_NAME
dbUser=DM_DB_NAME
dbPasswordFile=DM_INSTALL_DIR/etc/DM_DB_NAME.db.passwd
[MongoDbManager]
mongoDbName=dm
mongoDbUri=mongodb://localhost:27017
mongoDbUser=dm
mongoDbPasswordFile=DM_INSTALL_DIR/etc/DM_DB_NAME.db.passwd
[FileProcessingManager]
numberOfProcessingThreads=3
defaultNumberOfRetries=3
defaultRetryWaitPeriodInSeconds=60
#fileProcessor1=dm.common.processing.plugins.mongoDbFileCatalogPlugin.MongoDbFileCatalogPlugin()
#fileProcessor2=dm.common.processing.plugins.sddsParameterProcessingPlugin.SddsParameterProcessingPlugin()
#fileProcessor3=dm.common.processing.plugins.scriptProcessingPlugin.ScriptProcessingPlugin()
#fileProcessor4=dm.common.processing.plugins.sgeJobSubmissionPlugin.SgeJobSubmissionPlugin('/opt/sge')
# Available logger levels: debug, info, warn, error, critical
[ConsoleLogging]
handler=ConsoleLoggingHandler(sys.stdout,)
level=debug
format=%(asctime)s,%(msecs)003d %(levelname)s %(filename)s:%(lineno)d %(process)d: %(message)s
dateFormat=%Y/%m/%d %H:%M:%S
[FileLogging]
handler=TimedRotatingFileLoggingHandler('DM_INSTALL_DIR/var/log/ds-web-service.log')
level=debug
format=%(asctime)s,%(msecs)003d %(levelname)s %(filename)s:%(lineno)d %(process)d: %(message)s
dateFormat=%Y/%m/%d %H:%M:%S
#!/bin/bash
#
# dm-cat-web-service
#
# Starts the DM WebService daemon
#
# chkconfig: 345 98 98
# description: controls DM Web Service daemon
### BEGIN INIT INFO
# Provides: dm-cat-web-service
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Controls DM CAT Web Service daemon
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
# Arguments
ACTION=$1
DM_DB_NAME=$2
DM_DB_NAME=${DM_DB_NAME:=dm}
# Set root to default if needed.
MY_DIR=`dirname $0` && cd $MY_DIR && MY_DIR=`pwd`
if [ -z "${DM_ROOT_DIR}" ]; then
DM_ROOT_DIR=$MY_DIR/../..
fi
# Source environment file.
DM_USER=`id -nu`
DM_HOST=`hostname -s`
DM_ENV_FILE=${DM_ROOT_DIR}/setup.sh
if [ ! -f ${DM_ENV_FILE} ]; then
echo "Environment file ${DM_ENV_FILE} does not exist."
exit 2
fi
. ${DM_ENV_FILE} > /dev/null
mkdir -p ${DM_INSTALL_DIR}/var/run
mkdir -p ${DM_INSTALL_DIR}/var/log
DM_DAEMON_NAME="${DM_DB_NAME}.CatWebService"
DM_DAEMON_CMD=${DM_ROOT_DIR}/sbin/catWebService.py
DM_PID_FILE=${DM_INSTALL_DIR}/var/run/${DM_DB_NAME}.cat-web-service.pid
DM_CONFIG_FILE=${DM_INSTALL_DIR}/etc/${DM_DB_NAME}.cat-web-service.conf
DM_DAEMON_START_ARGS="-d -p $DM_PID_FILE --config-file $DM_CONFIG_FILE"
# Determine su command
SU=su
if [ -x /sbin/runuser ]; then
SU=runuser
fi
RETVAL=0
start() {
# Check if service is already running
status -p $DM_PID_FILE > /dev/null 2>&1
if [ $? -eq 0 ]; then
PID=`cat $DM_PID_FILE`
echo $"$DM_DAEMON_NAME daemon is already running (pid: $PID)."
RETVAL=1
return $RETVAL
fi
echo -n $"Starting $DM_DAEMON_NAME daemon: "
# Check if we're a privileged user
if [ `id -u` = 0 -a ${DM_USER} != "root" ]; then
$SU -m -c "${DM_DAEMON_CMD} ${DM_DAEMON_START_ARGS}" ${DM_USER}
else
${DM_DAEMON_CMD} ${DM_DAEMON_START_ARGS}
fi
RETVAL=$?
[ $RETVAL -eq 0 ] && success $"$DM_DAEMON_NAME startup" || failure $"$DM_DAEMON_NAME startup"
echo
return $RETVAL
}
stop() {
# Check if service is already running
status -p $DM_PID_FILE > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo $"$DM_DAEMON_NAME daemon is not running."
RETVAL=1
return $RETVAL
fi
echo -n $"Stopping $DM_DAEMON_NAME daemon: "
PID=`cat $DM_PID_FILE`
kill $PID
RETVAL=$?
sleep 1
# Make sure we kill the process always, regardless of
# what happened with first kill
kill -KILL $PID > /dev/null 2>&1
[ $RETVAL -eq 0 ] && rm -f $DM_PID_FILE && success $"$DM_DAEMON_NAME shutdown" || failure $"$DM_DAEMON_NAME shutdown"
echo
return $RETVAL
}
restart() {
stop
sleep 1
start
}
case "$ACTION" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status -p $DM_PID_FILE "$DM_DAEMON_NAME" 2> /dev/null
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
RETVAL=2
esac
exit $RETVAL
#!/bin/sh
# Helper script to start and stop DAQ node services
MY_DIR=`dirname $0` && cd $MY_DIR && MY_DIR=`pwd`
# The list below defines order of starting/stopping services
startList="mongodb mongo-express daq-web-service cat-web-service"
stopList="cat-web-service daq-web-service mongo-express mongodb"
restartList=$startList
statusList=$startList
# Check action
action=$1
case $action in
start|stop|restart|status)
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac
# Perform action
serviceList="\$"${action}List
serviceList=`eval "echo $serviceList"`
for service in $serviceList; do
$MY_DIR/dm-$service $action
sleep 1
done
#!/bin/bash
#
# dm-daq-web-service
#
# Starts the DM WebService daemon
#
# chkconfig: 345 98 98
# description: controls DM Web Service daemon
### BEGIN INIT INFO
# Provides: dm-daq-web-service
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Controls DM DAQ Web Service daemon
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
# Arguments
ACTION=$1
DM_DB_NAME=$2
DM_DB_NAME=${DM_DB_NAME:=dm}
# Set root to default if needed.
MY_DIR=`dirname $0` && cd $MY_DIR && MY_DIR=`pwd`
if [ -z "${DM_ROOT_DIR}" ]; then
DM_ROOT_DIR=$MY_DIR/../..
fi
# Source environment file.
DM_USER=`id -nu`
DM_HOST=`hostname -s`
DM_ENV_FILE=${DM_ROOT_DIR}/setup.sh
if [ ! -f ${DM_ENV_FILE} ]; then
echo "Environment file ${DM_ENV_FILE} does not exist."
exit 2
fi
. ${DM_ENV_FILE} > /dev/null
mkdir -p ${DM_INSTALL_DIR}/var/run
mkdir -p ${DM_INSTALL_DIR}/var/log
DM_DAEMON_NAME="${DM_DB_NAME}.DaqWebService"
DM_DAEMON_CMD=${DM_ROOT_DIR}/sbin/daqWebService.py
DM_PID_FILE=${DM_INSTALL_DIR}/var/run/${DM_DB_NAME}.daq-web-service.pid
DM_CONFIG_FILE=${DM_INSTALL_DIR}/etc/${DM_DB_NAME}.daq-web-service.conf
DM_DAEMON_START_ARGS="-d -p $DM_PID_FILE --config-file $DM_CONFIG_FILE"
# Determine su command
SU=su
if [ -x /sbin/runuser ]; then
SU=runuser
fi
RETVAL=0
start() {
# Check if service is already running
status -p $DM_PID_FILE > /dev/null 2>&1
if [ $? -eq 0 ]; then
PID=`cat $DM_PID_FILE`
echo $"$DM_DAEMON_NAME daemon is already running (pid: $PID)."
RETVAL=1
return $RETVAL
fi
echo -n $"Starting $DM_DAEMON_NAME daemon: "
# Check if we're a privileged user
if [ `id -u` = 0 -a ${DM_USER} != "root" ]; then
$SU -m -c "${DM_DAEMON_CMD} ${DM_DAEMON_START_ARGS}" ${DM_USER}
else
${DM_DAEMON_CMD} ${DM_DAEMON_START_ARGS}
fi
RETVAL=$?
[ $RETVAL -eq 0 ] && success $"$DM_DAEMON_NAME startup" || failure $"$DM_DAEMON_NAME startup"
echo
return $RETVAL
}
stop() {
# Check if service is already running
status -p $DM_PID_FILE > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo $"$DM_DAEMON_NAME daemon is not running."
RETVAL=1
return $RETVAL
fi
echo -n $"Stopping $DM_DAEMON_NAME daemon: "
PID=`cat $DM_PID_FILE`
kill $PID
RETVAL=$?
sleep 1
# Make sure we kill the process always, regardless of
# what happened with first kill
kill -KILL $PID > /dev/null 2>&1
[ $RETVAL -eq 0 ] && rm -f $DM_PID_FILE && success $"$DM_DAEMON_NAME shutdown" || failure $"$DM_DAEMON_NAME shutdown"
echo
return $RETVAL
}
restart() {
stop
sleep 1
start
}
case "$ACTION" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status -p $DM_PID_FILE "$DM_DAEMON_NAME" 2> /dev/null
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
RETVAL=2
esac
exit $RETVAL
#!/bin/sh
# Helper script to start and stop DAQ node services
MY_DIR=`dirname $0` && cd $MYDIR && MYDIR=`pwd`
# The list below defines order of starting/stopping services
startList="postgresql glassfish ds-web-service"
stopList="ds-web-service glassfish postgresql"
restartList=$startList
statusList=$startList
# Check action
action=$1
case $action in
start|stop|restart|status)
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac
# Perform action
serviceList="\$"${action}List
serviceList=`eval "echo $serviceList"`
for service in $serviceList; do
$MY_DIR/dm-$service $action
sleep 1
done
#!/bin/bash
#
# dm-ds-web-service
#
# Starts the DM WebService daemon
#
# chkconfig: 345 98 98
# description: controls DM Web Service daemon
### BEGIN INIT INFO
# Provides: dm-ds-web-service
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Controls DM DS Web Service daemon
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
# Arguments
ACTION=$1
DM_DB_NAME=$2
DM_DB_NAME=${DM_DB_NAME:=dm}
# Set root to default if needed.
MY_DIR=`dirname $0` && cd $MY_DIR && MY_DIR=`pwd`
if [ -z "${DM_ROOT_DIR}" ]; then
DM_ROOT_DIR=$MY_DIR/../..
fi
# Source environment file.
DM_USER=`id -nu`
DM_HOST=`hostname -s`
DM_ENV_FILE=${DM_ROOT_DIR}/setup.sh
if [ ! -f ${DM_ENV_FILE} ]; then
echo "Environment file ${DM_ENV_FILE} does not exist."
exit 2
fi
. ${DM_ENV_FILE} > /dev/null
mkdir -p ${DM_INSTALL_DIR}/var/run
mkdir -p ${DM_INSTALL_DIR}/var/log
DM_DAEMON_NAME="${DM_DB_NAME}.DsWebService"
DM_DAEMON_CMD=${DM_ROOT_DIR}/sbin/dsWebService.py
DM_PID_FILE=${DM_INSTALL_DIR}/var/run/${DM_DB_NAME}.ds-web-service.pid
DM_CONFIG_FILE=${DM_INSTALL_DIR}/etc/${DM_DB_NAME}.ds-web-service.conf
DM_DAEMON_START_ARGS="-d -p $DM_PID_FILE --config-file $DM_CONFIG_FILE"
# Determine su command
SU=su
if [ -x /sbin/runuser ]; then
SU=runuser
fi
RETVAL=0
start() {
# Check if service is already running
status -p $DM_PID_FILE > /dev/null 2>&1
if [ $? -eq 0 ]; then
PID=`cat $DM_PID_FILE`
echo $"$DM_DAEMON_NAME daemon is already running (pid: $PID)."
RETVAL=1
return $RETVAL
fi
echo -n $"Starting $DM_DAEMON_NAME daemon: "
# Check if we're a privileged user
if [ `id -u` = 0 -a ${DM_USER} != "root" ]; then
$SU -m -c "${DM_DAEMON_CMD} ${DM_DAEMON_START_ARGS}" ${DM_USER}
else
${DM_DAEMON_CMD} ${DM_DAEMON_START_ARGS}
fi
RETVAL=$?
[ $RETVAL -eq 0 ] && success $"$DM_DAEMON_NAME startup" || failure $"$DM_DAEMON_NAME startup"
echo
return $RETVAL
}
stop() {
# Check if service is already running
status -p $DM_PID_FILE > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo $"$DM_DAEMON_NAME daemon is not running."
RETVAL=1
return $RETVAL
fi
echo -n $"Stopping $DM_DAEMON_NAME daemon: "
PID=`cat $DM_PID_FILE`
kill $PID
RETVAL=$?
sleep 1
# Make sure we kill the process always, regardless of
# what happened with first kill
kill -KILL $PID > /dev/null 2>&1
[ $RETVAL -eq 0 ] && rm -f $DM_PID_FILE && success $"$DM_DAEMON_NAME shutdown" || failure $"$DM_DAEMON_NAME shutdown"
echo
return $RETVAL
}
restart() {
stop
sleep 1
start
}
case "$ACTION" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status -p $DM_PID_FILE "$DM_DAEMON_NAME" 2> /dev/null
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
RETVAL=2
esac
exit $RETVAL
#! /bin/sh
### BEGIN INIT INFO
# Provides: glassfish
# Required-Start: $remote_fs $network $syslog
# Required-Stop: $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts GlassFish
# Description: Starts GlassFish application server
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Set root to default if needed.
MY_DIR=`dirname $0` && cd $MY_DIR && MY_DIR=`pwd`
if [ -z "${DM_ROOT_DIR}" ]; then
DM_ROOT_DIR=$MY_DIR/../..
fi
# Source environment file.
DM_USER=`id -nu`
DM_HOST=`hostname -s`
DM_ENV_FILE=${DM_ROOT_DIR}/setup.sh
if [ ! -f ${DM_ENV_FILE} ]; then
echo "Environment file ${DM_ENV_FILE} does not exist."
exit 2
fi
. ${DM_ENV_FILE} > /dev/null
export AS_JAVA=$DM_OPT_DIR/java/$DM_HOST_ARCH
DM_GLASSFISH_DIR=$DM_OPT_DIR/glassfish
DERBY_DIR=$DM_OPT_DIR/glassfish/javadb/bin
DM_DAEMON_NAME=glassfish
DM_DAEMON_CONTROL_CMD=$DM_GLASSFISH_DIR/bin/asadmin
DM_DAEMON_START_ARGS="start-domain domain1"
DM_DAEMON_STOP_ARGS="stop-domain domain1"
DM_DAEMON_STATUS_CMDS="uptime list-domains list-applications list-jdbc-resources"
start() {
echo -n $"Starting ${DM_DAEMON_NAME}: "
# Check if we're a privileged user
if [ `id -u` = 0 -a ${DM_USER} != "root" ]; then
su -m -c "${DM_DAEMON_CONTROL_CMD} ${DM_DAEMON_START_ARGS}" ${DM_USER}
else
${DM_DAEMON_CONTROL_CMD} ${DM_DAEMON_START_ARGS}
fi
RETVAL=$?
[ $RETVAL -eq 0 ] && success $"${DM_DAEMON_NAME} startup" || failure $"${DM_DAEMON_NAME} startup"
echo
}
stop() {
echo -n $"Stopping ${DM_DAEMON_NAME}: "
# Check if we're a privileged user
if [ `id -u` = 0 -a ${DM_USER} != "root" ]; then
su -m -c "${DM_DAEMON_CONTROL_CMD} ${DM_DAEMON_STOP_ARGS}" ${DM_USER}
else
${DM_DAEMON_CONTROL_CMD} ${DM_DAEMON_STOP_ARGS}
fi
RETVAL=$?
[ $RETVAL -eq 0 ] && success $"${DM_DAEMON_NAME} shutdown" || failure $"${DM_DAEMON_NAME} shutdown"
echo
}
status() {
# Check if we're a privileged user
if [ `id -u` = 0 -a ${DM_USER} != "root" ]; then
for cmd in ${DM_DAEMON_STATUS_CMDS}; do
su -m -c "${DM_DAEMON_CONTROL_CMD} ${cmd}" ${DM_USER}
done
else
for cmd in ${DM_DAEMON_STATUS_CMDS}; do
${DM_DAEMON_CONTROL_CMD} ${cmd}
done
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
#!/bin/bash
#
# dm-mongo-express
#
# Starts the DM Mongo Express daemon
#
# chkconfig: 345 98 98
# description: controls DM Mongo Express daemon
### BEGIN INIT INFO
# Provides: dm-mongo-express
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Controls DM Mongo Express daemon
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
# Arguments
ACTION=$1
DM_DB_NAME=$2
DM_DB_NAME=${DM_DB_NAME:=dm}
# Set root to default if needed.
MY_DIR=`dirname $0` && cd $MY_DIR && MY_DIR=`pwd`
if [ -z "${DM_ROOT_DIR}" ]; then
DM_ROOT_DIR=$MY_DIR/../..
fi
# Source environment file.
DM_USER=`id -nu`
DM_HOST=`hostname -s`
DM_ENV_FILE=${DM_ROOT_DIR}/setup.sh
if [ ! -f ${DM_ENV_FILE} ]; then
echo "Environment file ${DM_ENV_FILE} does not exist."
exit 2
fi
. ${DM_ENV_FILE} > /dev/null
mkdir -p ${DM_INSTALL_DIR}/var/run
mkdir -p ${DM_INSTALL_DIR}/var/log
DM_MONGODB_HOST=${DM_MONGODB_HOST:=127.0.0.1}
DM_MONGODB_PORT=${DM_MONGODB_PORT:=27017}
DM_NODE_DIR=${DM_OPT_DIR}/node
DM_FOREVER_DIR=${DM_NODE_DIR}/bin/node_modules/forever
DM_MONGO_EXPRESS_DIR=${DM_NODE_DIR}/bin/node_modules/mongo-express
DM_DAEMON_NAME="${DM_DB_NAME}.MongoExpress"
DM_DAEMON_CMD=${DM_FOREVER_DIR}/bin/forever
DM_DAEMON_WORK_DIR=${DM_INSTALL_DIR}/var/run/mongo-express
DM_DAEMON_PID_FILE=${DM_INSTALL_DIR}/var/run/mongo-express.pid
DM_DAEMON_LOG_FILE=${DM_INSTALL_DIR}/var/log/mongo-express.log
DM_DAEMON_OUT_FILE=${DM_INSTALL_DIR}/var/log/mongo-express.put
DM_DAEMON_ERR_FILE=${DM_INSTALL_DIR}/var/log/mongo-express.err
DM_DAEMON_START_ARGS="start \
--sourceDIR $DM_MONGO_EXPRESS_DIR \
--workingDir $DM_DAEMON_WORK_DIR \
-p $MONGO_EXPRESS_FOREVER_PATH \
--pidFile $DM_DAEMON_PID_FILE \
-l $DM_DAEMON_LOG_FILE \
-o $DM_DAEMON_OUT_FILE \
-e $DM_DAEMON_ERR_FILE \
--append \
--killSignal=SIGTERM \
$DM_MONGO_EXPRESS_DIR/app.js"
mkdir -p $DM_DAEMON_WORK_DIR
# Determine su command
SU=su
if [ -x /sbin/runuser ]; then
SU=runuser
fi
RETVAL=0
start() {
# Check if service is already running
status -p $DM_DAEMON_PID_FILE > /dev/null 2>&1
if [ $? -eq 0 ]; then
PID=`cat $DM_DAEMON_PID_FILE`
echo $"$DM_DAEMON_NAME daemon is already running (pid: $PID)."
RETVAL=1
return $RETVAL
fi
echo -n $"Starting $DM_DAEMON_NAME daemon: "
# Check if we're a privileged user
if [ `id -u` = 0 -a ${DM_USER} != "root" ]; then
$SU -m -c "${DM_DAEMON_CMD} ${DM_DAEMON_START_ARGS}" ${DM_USER}
else
${DM_DAEMON_CMD} ${DM_DAEMON_START_ARGS}
fi
RETVAL=$?
[ $RETVAL -eq 0 ] && success $"$DM_DAEMON_NAME startup" || failure $"$DM_DAEMON_NAME startup"
echo
return $RETVAL
}
stop() {
# Check if service is already running
status -p $DM_DAEMON_PID_FILE > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo $"$DM_DAEMON_NAME daemon is not running."
RETVAL=1
return $RETVAL
fi
echo -n $"Stopping $DM_DAEMON_NAME daemon: "
PID=`cat $DM_DAEMON_PID_FILE`
$DM_DAEMON_CMD stop $PID
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $DM_DAEMON_PID_FILE && success $"$DM_DAEMON_NAME shutdown" || failure $"$DM_DAEMON_NAME shutdown"
echo
return $RETVAL
}
restart() {
stop
sleep 1
start
}
case "$ACTION" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status -p $DM_DAEMON_PID_FILE "$DM_DAEMON_NAME" 2> /dev/null
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
RETVAL=2
esac
exit $RETVAL
#!/bin/bash
#
# dm-mongodb
#
# Starts the DM Mongo DB daemon
#
# chkconfig: 345 98 98
# description: controls DM Mongo DB daemon
### BEGIN INIT INFO
# Provides: dm-mongodb
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Controls DM Mongo DB daemon
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
# Arguments
ACTION=$1
DM_DB_NAME=$2
DM_DB_NAME=${DM_DB_NAME:=dm}
# Set root to default if needed.
MY_DIR=`dirname $0` && cd $MY_DIR && MY_DIR=`pwd`
if [ -z "${DM_ROOT_DIR}" ]; then
DM_ROOT_DIR=$MY_DIR/../..
fi
# Source environment file.
DM_USER=`id -nu`
DM_HOST=`hostname -s`
DM_ENV_FILE=${DM_ROOT_DIR}/setup.sh
if [ ! -f ${DM_ENV_FILE} ]; then
echo "Environment file ${DM_ENV_FILE} does not exist."
exit 2
fi
. ${DM_ENV_FILE} > /dev/null
mkdir -p ${DM_INSTALL_DIR}/var/run
mkdir -p ${DM_INSTALL_DIR}/var/log
DM_MONGODB_HOST=${DM_MONGODB_HOST:=127.0.0.1}
DM_MONGODB_PORT=${DM_MONGODB_PORT:=27017}
DM_MONGODB_DIR=${DM_OPT_DIR}/mongodb/${DM_HOST_ARCH}
DM_MONGODB_DATA_DIR=${DM_MONGODB_DIR}/data
mkdir -p ${DM_MONGODB_DATA_DIR}
DM_DAEMON_NAME="${DM_DB_NAME}.MongoDB"
DM_DAEMON_CMD=${DM_MONGODB_DIR}/bin/mongod
DM_DAEMON_PID_FILE=${DM_INSTALL_DIR}/var/run/mongodb.pid
DM_DAEMON_LOG_FILE=${DM_INSTALL_DIR}/var/log/mongodb.log
DM_DAEMON_START_ARGS="--fork --pidfilepath $DM_DAEMON_PID_FILE --logpath $DM_DAEMON_LOG_FILE --bind_ip $DM_MONGODB_HOST --port $DM_MONGODB_PORT --dbpath $DM_MONGODB_DATA_DIR"
# Determine su command
SU=su
if [ -x /sbin/runuser ]; then
SU=runuser
fi
RETVAL=0
start() {
# Check if service is already running
status -p $DM_DAEMON_PID_FILE > /dev/null 2>&1
if [ $? -eq 0 ]; then
PID=`cat $DM_DAEMON_PID_FILE`
echo $"$DM_DAEMON_NAME daemon is already running (pid: $PID)."
RETVAL=1
return $RETVAL
fi
echo -n $"Starting $DM_DAEMON_NAME daemon: "
# Check if we're a privileged user
if [ `id -u` = 0 -a ${DM_USER} != "root" ]; then
$SU -m -c "${DM_DAEMON_CMD} ${DM_DAEMON_START_ARGS}" ${DM_USER}
else
${DM_DAEMON_CMD} ${DM_DAEMON_START_ARGS}
fi
RETVAL=$?
[ $RETVAL -eq 0 ] && success $"$DM_DAEMON_NAME startup" || failure $"$DM_DAEMON_NAME startup"
echo
return $RETVAL
}
stop() {
# Check if service is already running
status -p $DM_DAEMON_PID_FILE > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo $"$DM_DAEMON_NAME daemon is not running."
RETVAL=1
return $RETVAL
fi
echo -n $"Stopping $DM_DAEMON_NAME daemon: "
PID=`cat $DM_DAEMON_PID_FILE`
kill $PID
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $DM_DAEMON_PID_FILE && success $"$DM_DAEMON_NAME shutdown" || failure $"$DM_DAEMON_NAME shutdown"
echo
return $RETVAL
}
restart() {
stop
sleep 1
start
}
case "$ACTION" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status -p $DM_DAEMON_PID_FILE "$DM_DAEMON_NAME" 2> /dev/null
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
RETVAL=2
esac
exit $RETVAL
#!/bin/sh
#
# dm-postgresql
#
# Starts the PostgreSQL server used for DM software
#
# Modified from the original RHEL postgresql init.d script
#
# chkconfig: 345 97 97
# description: controls Dm database server
### BEGIN INIT INFO
# Provides: dm-postgresql
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: controls Dm database server
### END INIT INFO
# PGVERSION is the full package version, e.g., 8.4.0
#PGVERSION=9.3.4
PGVERSION=9.6.1
# PGMAJORVERSION is major version, e.g., 8.4 (this should match PG_VERSION)
PGMAJORVERSION=`echo "$PGVERSION" | sed 's/^\([0-9]*\.[0-9]*\).*$/\1/'`
# Source function library.
. /etc/rc.d/init.d/functions
# Get function listing for cross-distribution logic.
TYPESET=`typeset -f|grep "declare"`
# Get config.
. /etc/sysconfig/network
# Find the name of the script
# NAME=`basename $0`
NAME="DM Database"
# For SELinux we need to use 'runuser' not 'su'
SU=su
if [ -x /sbin/runuser ]; then
SU=runuser
fi
# Check if we are root before running command
runCommand() {
_cmd="$@"
if [ `id -u` = 0 ]; then
$SU -l $PGUSER -c "_$cmd" >> $PGSTARTUPLOG 2>&1 < /dev/null
else
eval "$_cmd" >> $PGSTARTUPLOG 2>&1 < /dev/null
fi
}
# Set defaults for configuration variables
if [ -z $DM_ROOT_DIR ]; then
myDir=`dirname $0`
currentDir=`pwd` && cd $myDir/../..
export DM_ROOT_DIR=`pwd`
cd $currentDir
fi
DM_SETUP_FILE=$DM_ROOT_DIR/setup.sh
if [ ! -f $DM_SETUP_FILE ]; then
echo "Setup file $DM_SETUP_FILE does not exist."
exit 2
fi
. $DM_SETUP_FILE > /dev/null
PGROOT=$DM_OPT_DIR/postgresql/$DM_HOST_ARCH
PGENGINE=$PGROOT/bin
#PGUSER=dm
PGUSER=`whoami`
PGGROUP=`groups $PGUSER | cut -f3 -d ' '`
PGPORT=11136 # 111-DM
PGDATA=$PGROOT/data
PGRUNDIR=$DM_INSTALL_DIR/var/run
PGLOGDIR=$DM_INSTALL_DIR/var/log
PGSTARTUPLOG=$PGLOGDIR/postgresql
PGPIDFILE=$PGRUNDIR/postmaster.pid
PGLOCKFILE=$PGRUNDIR/postmaster.lock
mkdir -p $PGDATA && chown -R $PGUSER:$PGGROUP $PGDATA || exit 1
mkdir -p $PGRUNDIR && chown -R $PGUSER:$PGGROUP $PGRUNDIR || exit 1
mkdir -p $PGLOGDIR && chown -R $PGUSER:$PGGROUP $PGLOGDIR || exit 1
export PGDATA
export PGPORT
export LD_LIBRARY_PATH=$PGROOT/lib
# Check that networking is up.
# Pretty much need it for postmaster.
[ "${NETWORKING}" = "no" ] && exit 1
[ -f "$PGENGINE/postmaster" ] || exit 1
script_result=0
start() {
PSQL_START=$"Starting ${NAME} service: "
# Make sure startup-time log file is valid
if [ ! -e "$PGSTARTUPLOG" -a ! -h "$PGSTARTUPLOG" ]; then
touch "$PGSTARTUPLOG" || exit 1
chown $PGUSER:$PGGROUP "$PGSTARTUPLOG"
chmod go-rwx "$PGSTARTUPLOG"
[ -x /sbin/restorecon ] && /sbin/restorecon "$PGSTARTUPLOG"
fi
# Check for the PGDATA structure
if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base" ]; then
# Check version of existing PGDATA
if [ x`cat "$PGDATA/PG_VERSION"` != x"$PGMAJORVERSION" ]; then
SYSDOCDIR="(Your System's documentation directory)"
echo
echo $"An old version of the database format was found."
echo $"You need to upgrade the data format before using PostgreSQL."
echo $"See $SYSDOCDIR/postgresql-$PGVERSION/README.rpm-dist for more information."
exit 1
fi
# No existing PGDATA! Warn the user to initdb it.
else
echo
echo "$PGDATA is missing. Use \"$0 initdb\" to initialize the cluster first."
echo_failure
echo
exit 1
fi
echo -n "$PSQL_START"
cmd="$PGENGINE/postmaster -p '$PGPORT' -D '$PGDATA' ${PGOPTS} &"
runCommand $cmd
sleep 2
pid=`pidof -s "$PGENGINE/postmaster"`
if [ $pid ] && [ -f "$PGDATA/postmaster.pid" ]; then
success "$PSQL_START"
touch $PGLOCKFILE
head -n 1 "$PGDATA/postmaster.pid" > $PGPIDFILE
echo
else
failure "$PSQL_START"
echo
script_result=1
fi
}
stop() {
echo -n $"Stopping ${NAME} service: "
cmd="export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; $PGENGINE/pg_ctl stop -D '$PGDATA' -s -m fast"
runCommand $cmd
ret=$?
if [ $ret -eq 0 ]; then
echo_success
else
echo_failure
script_result=1
fi
echo
rm -f $PGPIDFILE
rm -f $PGLOCKFILE
}
restart() {
stop
start
}
condrestart() {
[ -e $PGLOCKFILE ] && restart
}
condstop() {
[ -e $PGLOCKFILE ] && stop
}
reload() {
cmd="export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; $PGENGINE/pg_ctl reload -D '$PGDATA' -s"
runCommand $cmd
}
initdb() {
if [ -f "$PGDATA/PG_VERSION" ]; then
echo -n "Data directory is not empty!"
echo_failure
echo
script_result=1
else
echo -n $"Initializing database: "
if [ ! -e "$PGDATA" -a ! -h "$PGDATA" ]; then
mkdir -p "$PGDATA" || exit 1
chown $PGUSER:$PGGROUP "$PGDATA"
chmod go-rwx "$PGDATA"
fi
# Clean up SELinux tagging for PGDATA
[ -x /sbin/restorecon ] && /sbin/restorecon "$PGDATA"
# Make sure the startup-time log file is OK, too
if [ ! -e "$PGSTARTUPLOG" -a ! -h "$PGSTARTUPLOG" ]; then
touch "$PGSTARTUPLOG" || exit 1
chown $PGUSER:$PGGROUP "$PGSTARTUPLOG"
chmod go-rwx "$PGSTARTUPLOG"
[ -x /sbin/restorecon ] && /sbin/restorecon "$PGSTARTUPLOG"
fi
# Initialize the database
cmd="$PGENGINE/initdb --pgdata='$PGDATA' --auth='ident'"
runCommand $cmd
# Create directory for postmaster log
mkdir -p "$PGDATA/pg_log"
chown $PGUSER:$PGGROUP "$PGDATA/pg_log"
chmod go-rwx "$PGDATA/pg_log"
if [ -f "$PGDATA/PG_VERSION" ]; then
echo_success
else
echo_failure
script_result=1
fi
echo
fi
}
# This script is slightly unusual in that the name of the daemon (postmaster)
# is not the same as the name of the subsystem (postgresql)
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status postmaster
script_result=$?
;;
restart)
restart
;;
condrestart)
condrestart
;;
condstop)
condstop
;;
reload|force-reload)
reload
;;
initdb)
initdb
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|condstop|reload|force-reload|initdb}"
exit 1
esac
exit $script_result
#!/bin/bash
#
# dm-proc-web-service
#
# Starts the DM PROC WebService daemon
#
# chkconfig: 345 98 98
# description: controls DM PROC Web Service daemon
### BEGIN INIT INFO
# Provides: dm-proc-web-service
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Controls DM PROC Web Service daemon
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
# Arguments
ACTION=$1
DM_DB_NAME=$2
DM_DB_NAME=${DM_DB_NAME:=dm}
# Set root to default if needed.
MY_DIR=`dirname $0` && cd $MY_DIR && MY_DIR=`pwd`
if [ -z "${DM_ROOT_DIR}" ]; then
DM_ROOT_DIR=$MY_DIR/../..
fi
# Source environment file.
DM_USER=`id -nu`
DM_HOST=`hostname -s`
DM_ENV_FILE=${DM_ROOT_DIR}/setup.sh
if [ ! -f ${DM_ENV_FILE} ]; then
echo "Environment file ${DM_ENV_FILE} does not exist."
exit 2
fi
. ${DM_ENV_FILE} > /dev/null
mkdir -p ${DM_INSTALL_DIR}/var/run
mkdir -p ${DM_INSTALL_DIR}/var/log
DM_DAEMON_NAME="${DM_DB_NAME}.ProcWebService"
DM_DAEMON_CMD=${DM_ROOT_DIR}/sbin/procWebService.py
DM_PID_FILE=${DM_INSTALL_DIR}/var/run/${DM_DB_NAME}.proc-web-service.pid
DM_CONFIG_FILE=${DM_INSTALL_DIR}/etc/${DM_DB_NAME}.proc-web-service.conf
DM_DAEMON_START_ARGS="-d -p $DM_PID_FILE --config-file $DM_CONFIG_FILE"
# Determine su command
SU=su
if [ -x /sbin/runuser ]; then
SU=runuser
fi
RETVAL=0
start() {
# Check if service is already running
status -p $DM_PID_FILE > /dev/null 2>&1
if [ $? -eq 0 ]; then
PID=`cat $DM_PID_FILE`
echo $"$DM_DAEMON_NAME daemon is already running (pid: $PID)."
RETVAL=1
return $RETVAL
fi
echo -n $"Starting $DM_DAEMON_NAME daemon: "
# Check if we're a privileged user
if [ `id -u` = 0 -a ${DM_USER} != "root" ]; then
$SU -m -c "${DM_DAEMON_CMD} ${DM_DAEMON_START_ARGS}" ${DM_USER}
else
${DM_DAEMON_CMD} ${DM_DAEMON_START_ARGS}
fi
RETVAL=$?
[ $RETVAL -eq 0 ] && success $"$DM_DAEMON_NAME startup" || failure $"$DM_DAEMON_NAME startup"
echo
return $RETVAL
}
stop() {
# Check if service is already running
status -p $DM_PID_FILE > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo $"$DM_DAEMON_NAME daemon is not running."
RETVAL=1
return $RETVAL
fi
echo -n $"Stopping $DM_DAEMON_NAME daemon: "
PID=`cat $DM_PID_FILE`
kill $PID
RETVAL=$?
sleep 1
# Make sure we kill the process always, regardless of
# what happened with first kill
kill -KILL $PID > /dev/null 2>&1
[ $RETVAL -eq 0 ] && rm -f $DM_PID_FILE && success $"$DM_DAEMON_NAME shutdown" || failure $"$DM_DAEMON_NAME shutdown"
echo
return $RETVAL
}
restart() {
stop
sleep 1
start
}
case "$ACTION" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status -p $DM_PID_FILE "$DM_DAEMON_NAME" 2> /dev/null
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
RETVAL=2
esac
exit $RETVAL
#!/bin/sh
export DM_ROOT_DIR=
export DM_WEB_SERVICE_PROTOCOL=https
export DM_DS_WEB_SERVICE_HOST=
export DM_DS_WEB_SERVICE_PORT=
export DM_DAQ_WEB_SERVICE_HOST=
export DM_DAQ_WEB_SERVICE_PORT=
export DM_CAT_WEB_SERVICE_HOST=
export DM_CAT_WEB_SERVICE_PORT=
export DM_PROC_WEB_SERVICE_HOST=
export DM_PROC_WEB_SERVICE_PORT=
export DM_STATION_NAME=
export DM_ALLOWED_EXPERIMENT_TYPES=TEST
setupFile=$DM_ROOT_DIR/setup.sh
if [ ! -f $setupFile ]; then
echo "Cannot find setup file: $setupFile"
exit 1
fi
source $setupFile > /dev/null
../src/python
\ No newline at end of file
../src/python/dm/cat_web_service/service/catWebService.py
\ No newline at end of file