diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..b0c519bf
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+usr/local/src/unit-tests/shunit2
diff --git a/COPYING b/COPYING
index d71ac74c..39789d32 100644
--- a/COPYING
+++ b/COPYING
@@ -1,4 +1,4 @@
- Copyright 2011 Vizrt
+ Copyright 2011-2015 Escenic
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/README b/README
index d5ca69e6..fbcd9ef3 100644
--- a/README
+++ b/README
@@ -1,10 +1,16 @@
+========
+Note!
+========
+This version of ece-scripts is currently being modified to support java7, tomcat7 and content engine 5.6. During this transition the latest version of ece-scripts will not work correctly for previously released engine versions.
+
+
========
Overview
========
These are scripts to help template developers and administrators
manage various components of the Escenic Content Engine. The scripts
are experimental and not yet a part of the official distribution of
-Escenic Content Engine from Vizrt Online.
+Escenic Content Engine.
========================
Project directory layout
@@ -13,60 +19,39 @@ The file structure ressembles where you'd typically put the various
scripts and configuration files. That's all it is, only for
documentational purposes :-)
-==========================
-Features of the ece script
-==========================
-$ ece help
-Usage: /usr/bin/ece [-t ] [-i ]
+===================================
+Features of the /usr/bin/ece script
+===================================
+https://github.com/escenic/ece-scripts/blob/master/usr/share/doc/escenic/ece-guide.org
-DESCRIPTION
- -t --type
- The following types are available:
- engine - The Escenic Content Engine, this is the default
- and is the assumed type if none is specified.
- search - A standalone search indexer and solr instance
- rmi-hub - The RMI hub responsible for the internal
- communication between the ECE instances.
-
- -i --instance
- The type instance, such as editor1, web1 or search1
-
- -p --publication
- Needed only for updating publication resources
-
- -r --resource
- Needed only for updating publication resources.
- Must be one of: content-type, feature, layout, layout-group
- image-version, menu
- -v --verbose
- Prints out debug statements, useful for debugging.
+===================================
+Features of the /usr/bin/ece-import script
+===================================
+https://github.com/escenic/ece-scripts/blob/master/usr/share/doc/escenic/ece-import-guide.org
-The following commands are available:
- applog the type's app server log
- assemble runs the Assembly Tool *)
- clean removes temporary files created by /home/torstein/bin/ece *)
- deploy deploys the assembled EAR *)
- help prints this help screen
- kill uses force to stop the type
- log the type's Log4J log
- outlog the [ece#engine] script log (system out log)
- restart restarts the type
- start starts the type
- status checks if the type is running
- stop stops the type
- threaddump write a thread dump to standard out (system out log)
- update update publication resources
- versions lists the ECE component versions
+============================================
+Features of the /usr/sbin/ece-install script
+============================================
+https://github.com/escenic/ece-scripts/blob/master/usr/share/doc/escenic/ece-install-guide.org
-*) only applicable if type is 'engine'
+===========================================
+Features of the /usr/bin/system-info script
+===========================================
+https://github.com/escenic/ece-scripts/blob/master/usr/share/doc/escenic/system-info-guide.org
-==========================
-Feedback
-==========================
+====================================
+Features of the /usr/bin/vosa script
+====================================
+https://github.com/escenic/ece-scripts/blob/master/usr/share/doc/vizrt/vosa-guide.org
+========
+Feedback
+========
Hope you enjoy the ece /usr/bin and intit.d scripts. All feedback,
come hither!
--torstein@escenic.com
+Escenic Support support(at)escenic.com
+(The founder of this repo , Torstein, has move(d) on to other challenges)
+Commits to this repo will also show in our vosa hipchat room
diff --git a/TODO.md b/TODO.md
new file mode 100644
index 00000000..4c039a9f
--- /dev/null
+++ b/TODO.md
@@ -0,0 +1,65 @@
+
+# Version 3.x aka "akbash"
+
+## /usr/sbin/ece-install
+
+### ✔ Install ECE from APT
+Support for installing ECE & plugins using the escenic APT
+repositories.
+
+- ✔ Editor profile (Escenic Content Engine)
+- ✔ Presentation profile (Escenic Content Engine)
+- ✔ Search profile (ECE's indexer-webapp + Solr)
+- ✔ DB profile, ECE
+- ✔ DB profile, ECE plugins
+- ✔ Create publication(s) profile → Move to `/usr/bin/ece`
+- ✔ Analysis profile (Escenic Analysis Engine)
+- ✔ Analysis DB profile
+- ✔ Cache server profile
+- ✔ Assembly Tool
+
+### ✔ Install ECE from RPMs
+Support for installing ECE & plugins using the escenic RPM packages.
+
+- ✔ Editor profile (Escenic Content Engine)
+- ✔ Presentation profile (Escenic Content Engine)
+- ✔ Search profile (ECE's indexer-webapp + Solr)
+- ✔ DB profile, ECE
+- ✔ DB profile, ECE plugins
+- ✔ Create publication(s) profile → Move to `/usr/bin/ece`
+- ✔ Analysis profile (Escenic Analysis Engine)
+- ✔ Analysis DB profile
+- ✔ Cache server profile
+- ✔ Assembly Tool
+
+### ✔ Support for Varnish 4
+
+Varnish 3 has reached its end of life and Varnish 4 is in the official
+repositories of Debian stable, Ubuntu LTS and CentOS 7 and RedHat 7.
+
+### ✔ YAML configuration file format
+
+See the [unit tests](usr/local/src/unit-tests/ece-install-conf-file-reader-test.sh) for
+configuration examples.
+
+### ✔ Remove the interactive mode.
+
+It's rarely used and complicates the source code and configuration
+options unnecessarily.
+
+## ✔ /usr/bin/ece
+
+- ✔ New sub command: /usr/bin/ece create-publication
+
+- ✔ Easy to extend, e.g. put `create-publication.sh` in a directory,
+ e.g.`ece.d`, and get `ece create-publication`. The
+ `create-publication` sub command is then included in TAB completion,
+ help screens and `man` pages.
+
+
+## Version 4.x
+### Easier to extend `ece-install`
+
+Preferably in any language. Put a file in a directory and
+`ece-install` will execute that file at a predictable point in time.
+
diff --git a/etc/bash_completion.d/ece b/etc/bash_completion.d/ece
index f22da95f..0db3f9b4 100644
--- a/etc/bash_completion.d/ece
+++ b/etc/bash_completion.d/ece
@@ -1,40 +1,129 @@
-# auto completion for the /usr/bin/ece command.
-_ece_commands()
+# auto completion for the /usr/bin/ece command. Emacs: -*- sh -*- mode
+
+_get_sub_commands_for_ece() {
+ cat </dev/null
+ done
+
+ declare -F |
+ grep -q -w "${cmd_completion_function}" &&
+ "${cmd_completion_function}"
+}
+complete -F _get_completions_for_ece_command ece
diff --git a/etc/bash_completion.d/ece-deploy b/etc/bash_completion.d/ece-deploy
new file mode 100644
index 00000000..d1b7395f
--- /dev/null
+++ b/etc/bash_completion.d/ece-deploy
@@ -0,0 +1,33 @@
+# auto completion for the ece-deploy command. -*- sh -*-
+
+_ece-deploy_commands()
+{
+ local cur=${COMP_WORDS[COMP_CWORD]}
+ local prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ options="
+ --conf
+ --ear
+ --force
+ --list-deployments
+ --update-publication-resources
+ "
+
+ # default completions is the list of options
+ case "$prev" in
+ --conf)
+ completions="http://"
+ ;;
+ --ear)
+ completions="http://"
+ ;;
+ *)
+ completions="$options"
+ ;;
+ esac
+
+ COMPREPLY=( $(compgen -W "$completions" -- $cur) )
+}
+
+complete -o default -F _ece-deploy_commands ece-deploy
+
diff --git a/etc/bash_completion.d/ece-import b/etc/bash_completion.d/ece-import
new file mode 100644
index 00000000..4ff3eafc
--- /dev/null
+++ b/etc/bash_completion.d/ece-import
@@ -0,0 +1,32 @@
+# auto completion for the ece-import command. -*- sh -*-
+
+_ece-import_commands()
+{
+ local cur=${COMP_WORDS[COMP_CWORD]}
+ local prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ options="
+ --directories-only
+ --escenic-group
+ --escenic-user
+ --import-archive
+ --name
+ --password
+ --publication
+ --uri
+ --user
+ --version
+ -V
+ -f
+ -n
+ -p
+ "
+
+ # default completions is the list of options
+ completions="$options"
+
+ COMPREPLY=( $(compgen -W "$completions" -- $cur) )
+}
+
+complete -o default -F _ece-import_commands ece-import
+
diff --git a/etc/bash_completion.d/ece-install b/etc/bash_completion.d/ece-install
new file mode 100644
index 00000000..7ce24308
--- /dev/null
+++ b/etc/bash_completion.d/ece-install
@@ -0,0 +1,24 @@
+# auto completion for the ece-install command. -*- sh -*-
+
+_ece-install_commands()
+{
+ local cur=${COMP_WORDS[COMP_CWORD]}
+ local prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ options="
+ --conf-file
+ --verbose
+ --version
+ -V
+ -f
+ -v
+ "
+
+ # default completions is the list of options
+ completions="$options"
+
+ COMPREPLY=( $(compgen -W "$completions" -- $cur) )
+}
+
+complete -o default -F _ece-install_commands ece-install
+
diff --git a/etc/bash_completion.d/vosa b/etc/bash_completion.d/vosa
new file mode 100644
index 00000000..5e84442c
--- /dev/null
+++ b/etc/bash_completion.d/vosa
@@ -0,0 +1,19 @@
+# auto completion for the vosa command. -*- sh -*-
+
+_vosa_commands()
+{
+ local cur=${COMP_WORDS[COMP_CWORD]}
+ local prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ commands=$(
+ vosa commands | cut -f3 -d' ' | cut -f1 -d':'
+ )
+
+ # default completions is the list of commands
+ completions="$commands"
+
+ COMPREPLY=( $(compgen -W "$completions" -- $cur) )
+}
+
+complete -o default -F _vosa_commands vosa
+
diff --git a/etc/cron.d/periodic-check b/etc/cron.d/periodic-check
new file mode 100644
index 00000000..9f3fae0b
--- /dev/null
+++ b/etc/cron.d/periodic-check
@@ -0,0 +1,4 @@
+MAILTO=root
+
+* * * * * nagios /bin/sleep 20; if [ -x /usr/lib/periodic-check/main ]; then /usr/lib/periodic-check/main; fi
+
diff --git a/etc/cron.daily/remove-old-escenic-log-files b/etc/cron.daily/remove-old-escenic-log-files
new file mode 100755
index 00000000..71d2a483
--- /dev/null
+++ b/etc/cron.daily/remove-old-escenic-log-files
@@ -0,0 +1,33 @@
+#! /usr/bin/env bash
+
+# cron script to remove old escenic related log files. It's safe to
+# install this cron script on all servers, also the ones that don't
+# have Escenic Content Engine or Escenic Analysis Engine installed.
+
+function remove_old_escenic_log_files() {
+ if [ ! -e /etc/init.d/ece ]; then
+ return
+ fi
+
+ /etc/init.d/ece remove-old-log-files
+}
+
+if [ -r /etc/default/ece ]; then
+ source /etc/default/ece
+ if [ ${remove_old_log_files-0} -eq 1 ]; then
+ remove_old_escenic_log_files
+ fi
+fi
+
+# Added to take care of left over ear files in escenic cache by ece-install and ece-deploy
+if [ -r /etc/escenic/ece.conf ]; then
+ source /etc/escenic/ece.conf
+ if [ ! -z "${cache_dir}" ] && [ -d "${cache_dir}" ] ; then
+ nice find "${cache_dir}" -maxdepth 1 -type f -mtime +5 -delete
+ fi
+
+fi
+
+# Now clean the /tmp directory as well
+nice find /tmp -type f -mtime +3 -delete
+
diff --git a/etc/default/ece b/etc/default/ece
index f7b2368b..ac916343 100644
--- a/etc/default/ece
+++ b/etc/default/ece
@@ -4,13 +4,13 @@
# instances. If you only have one # instance, use "default" as its
# name. If you don't have any instances of that type on this host,
# then just set the variable to an empty string.
-engine_instance_list="app1 app2"
-search_instance_list="search1"
-analysis_instance_list="analysis1"
+engine_instance_list=""
+search_instance_list=""
+analysis_instance_list=""
# You only need one hub in an ECE cluster, so only set this one to
-# true on one host.
-enable_rmi_hub=true
+# true on one host. 1 means on, 0 means off.
+enable_rmi_hub=0
# The location of the ece script, default is /usr/bin/ece
ece_script=/usr/bin/ece
@@ -20,3 +20,7 @@ ece_script=/usr/bin/ece
ece_unix_group=escenic
ece_unix_user=escenic
+# Do you want cron to remove (5 days) old log files every day?
+# (default is yes, i.e. 1. Set 0 to turn this off)
+remove_old_log_files=1
+
diff --git a/etc/default/system-info b/etc/default/system-info
new file mode 100644
index 00000000..ec078780
--- /dev/null
+++ b/etc/default/system-info
@@ -0,0 +1,3 @@
+# If you have blockdiag installed, but don't want system-info to
+# generate diagrams, uncomment the following line:
+# do_not_generate_diagram=1
diff --git a/etc/escenic/ece.conf b/etc/escenic/ece.conf
index 2f3ad3bf..5aca995c 100644
--- a/etc/escenic/ece.conf
+++ b/etc/escenic/ece.conf
@@ -1,57 +1,88 @@
-# ece script configruation -*- sh -*-
+# ece script configruation -*- conf -*-
# version: $Revision: #1 $ $Date: 2011/02/18 $
# author: torstein@escenic.com
# last update by: $Author: shud $
-########################################################################
+#########################################################################
# Section I: Variables you probably want to change or at least verify
# make sense.
-########################################################################
+#########################################################################
-########################################################################
+#########################################################################
# Where the escenic content engine itself is installed
-########################################################################
+#########################################################################
ece_home=/opt/escenic/engine
-########################################################################
+#########################################################################
# Set this one if you're running more than one ECE instance on your
# host. Usually, you'll set it to the instance name. If you're running
# one ECE instance on your system, you may omit this one.
-########################################################################
+#########################################################################
# ece_server=rolling
# ece_server_hostname=quanah.escenic.com
-########################################################################
+#########################################################################
+# Set this one if you wish to have a Nursery configuration layer
+# special to the kind of enviornment you're running. An enviornment in
+# this context is: development, test, staging and prodution.
+#########################################################################
+# ece_environment=production
+
+#########################################################################
# Setting the java home, yes lowercase is correct ;-)
-########################################################################
-java_home=/usr/lib/jvm/java-6-sun
+#########################################################################
+java_home=/usr/lib/jvm/jdk-8-oracle-x64
-########################################################################
+#########################################################################
# Possible options are: tomcat, jboss, resin & oc4j
-########################################################################
+#########################################################################
appserver=tomcat
-########################################################################
+#########################################################################
+# App server port. If this variable is unset, ece will try to figure
+# out the port number by itself. ece-.conf should override
+# this when there's more than one ECE instance on the same host.
+#########################################################################
+appserver_port=8080
+
+#########################################################################
# Section II: Variables that are sensible defaults but may be changed
# to accommodate the conventions or tastes of your OS or company.
-########################################################################
+#########################################################################
-########################################################################
+#########################################################################
# Related to the ece script/ECE/hub/search
-########################################################################
+#########################################################################
assemblytool_home=/opt/escenic/assemblytool
cache_dir=/var/cache/escenic
-ece_security_configuration_dir=/etc/escenic/engine/common/security
+
+#########################################################################
+# Configuration directories
+#########################################################################
+# The root of all Escenic configuration files (not only ECE)
+escenic_conf_dir=/etc/escenic
+
+# The directory for the Escenic Analysis Engine/Stats' configuration
+# files. Note that this is different from the EAE plugin for Content
+# Studio, which has its configuration with the other ECE Nursery
+# components.
+analysis_conf_dir=$escenic_conf_dir/analysis
+ece_security_configuration_dir=${escenic_conf_dir}/engine/common/security
+rmi_hub_conf=${escenic_conf_dir}/rmi-hub
+
+#########################################################################
+# Other important directories
+#########################################################################
+data_dir=/var/lib/escenic
log_dir=/var/log/escenic
-pid_dir=/var/run/escenic
-rmi_hub_conf=/etc/escenic/rmi-hub
+run_dir=/var/run/escenic
rmi_hub_home=$ece_home/contrib/rmi-hub
solr_home=/var/lib/escenic/solr
tmp_dir=/tmp
-########################################################################
+#########################################################################
# When making a deployment, ece will default wise, deploy the EAR
# generated with "ece assemble" on the application server. The
# webapps included in the EAR can be filtered with the
@@ -65,12 +96,19 @@ tmp_dir=/tmp
# webapps listed here, will be deployed.
#
# Note: this is currently only supported when appserver=tomcat.
-#
+#
# deploy_webapp_white_list="escenic-admin pbe"
-########################################################################
+#########################################################################
+# Memcached support. 'ece -i deploy' will per default add
+# support for using memcached with your publication. If you wish to
+# turn this off, you can set this value to 0.
+#########################################################################
+# enable_memcached_support=1
+
+#########################################################################
# Where to find the various application servers
-########################################################################
+#########################################################################
jboss_home=/opt/jboss
oc4j_home=/opt/oc4j
resin_home=/opt/resin
@@ -81,48 +119,133 @@ tomcat_home=/usr/share/tomcat6
# binaries, just with different data.
# tomcat_base=/opt/tomcat-editor1
-########################################################################
+######################################################################
+# If you've compiled or installed APR support (native Tomcat
+# libraries, using the Apache APR library), you specify the install
+# directory here, if not comment it out.
+######################################################################
+apr_lib_dir=/usr/lib
+
+#########################################################################
# JVM related (the Java Virtual Machine)
-########################################################################
+#########################################################################
-########################################################################
+#########################################################################
# The minimum and maximum heap sizes for the Java process
-########################################################################
-min_heap_size=2048m
-max_heap_size=2048m
+#########################################################################
+min_heap_size=256m
+max_heap_size=256m
-########################################################################
+#########################################################################
# The permgen size is the amount of memory the JVM sets aside to class
# defintions. If you are experiencing constant OutOfMemory
# exceptions/errors and are using EAR deployment, you may want to
# increase these.
-########################################################################
+#########################################################################
min_permgen_size=64m
max_permgen_size=256m
-enable_heap_dump=0
enable_remote_debugging=0
remote_debugging_port=5005
enable_remote_monitoring=0
remote_monitoring_port=5792
-#####################################################################
+#########################################################################
+# Settings related to the JVM garbage collection, don't touch these if
+# you're not sure of what you're doing and have tested your changes
+# properly. Note that ece takes care of the GC logging, so you don't
+# have to cater for that here.
+#########################################################################
+jvm_gc_settings="
+-XX:+CMSClassUnloadingEnabled
+-XX:+CMSIncrementalPacing
+-XX:+CMSPermGenSweepingEnabled
+-XX:+ExplicitGCInvokesConcurrent
+-XX:+UseCMSInitiatingOccupancyOnly
+-XX:+UseConcMarkSweepGC
+-XX:CMSInitiatingOccupancyFraction=65
+-XX:InitialCodeCacheSize=50m
+-XX:MaxNewSize=250m
+-XX:NewSize=250m
+-XX:ParallelGCThreads=1
+-XX:ReservedCodeCacheSize=50m
+-XX:SurvivorRatio=1
+"
+
+######################################################################
+# If you want ECE/EAE to use an HTTP proxy to access the internet, set
+# the parameters you need here and remove the rest. Default is no HTTP
+# proxy. See
+# http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html
+# for more details on the available options here.
+######################################################################
+# jvm_proxy_settings="
+# -Dhttp.proxyHost=proxyserver
+# -Dhttp.proxyPort=3128
+# -Dhttp.nonProxyHosts=localhost
+# -Dhttps.proxyHost=proxyserver
+# -Dhttps.proxyPort=3128
+# "
+
+######################################################################
+# This overrides the default connection settings of all classes that
+# directly or indirectly open TCP connections inside the JVM.
+#
+# To ensue more stable connections to EAE, we set max timeouts
+# here. If you're not using EAE, you probably don't need these and can
+# comment out the variable.
+#
+# The values are in milliseconds and are set to 5 seconds (5000
+# milliseconds).
+jvm_connection_settings="
+ -Dsun.net.client.defaultConnectTimeout=1000
+ -Dsun.net.client.defaultReadTimeout=5000
+"
+
+######################################################################
+# Tell the JVM to use this encoding everywhere (in stead of falling
+# back to the system default).
+######################################################################
+jvm_encoding=UTF-8
+
+######################################################################
# Java will use IPv6 if it's available on the OS. This however, can
# cause problems with applications that insists on using IPv4
# sockets.
#
# If e.g. Tomcat cannot create a socket on a given port (which is not
# taken), you may need to set this one to '1'. Default is '0'.
-#####################################################################
+######################################################################
force_ipv4=0
-#####################################################################
-# Is this a production system?
-#####################################################################
-is_production=1
-
-#####################################################################
-# Ask the JVM to create a heap dump when/if it crashes.
-#####################################################################
+######################################################################
+# Ask the JVM to create a heap dump when/if it crashes.
+######################################################################
enable_heap_dump=1
heap_dump_dir=/var/crash/escenic
+
+######################################################################
+# Where 'ece -i backup' will put its snapshot
+# backups. Default is /var/backups/escenic.
+######################################################################
+backup_dir=/var/backups/escenic
+
+######################################################################
+# When removing old log files, how old should the oldest file be?
+######################################################################
+old_log_file_max_age_in_days=5
+
+######################################################################
+# HTTP authentication for the escenic-admin webapp (default is no HTTP
+# auth)
+######################################################################
+# escenic_admin_http_user=
+# escenic_admin_http_password=
+
+######################################################################
+# HTTP authentication for the build server (default is no HTTP auth),
+# this only used for when you use 'ece deploy' with a URI for an EAR
+# a the build server.
+######################################################################
+# builder_http_user=
+# builder_http_password=
diff --git a/etc/init.d/ece b/etc/init.d/ece
index dc2a515c..c6602280 100755
--- a/etc/init.d/ece
+++ b/etc/init.d/ece
@@ -5,8 +5,8 @@
### BEGIN INIT INFO
# Provides: ece
-# Required-Start: $remote_fs $network $syslog
-# Required-Stop: $remote_fs $network $syslog
+# Required-Start: $local_fs $network $syslog
+# Required-Stop: $local_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Escenic Content Engine
@@ -15,7 +15,7 @@
#################################################################
# Usage:
# * copy this script to /etc/init.d/ece
-#
+#
# * copy its configuration file to /etc/default/ece (or
# * /etc/conf.d/ece on Gentoo based disitributions)
#
@@ -25,31 +25,41 @@
# would be: update-rc.d ece defaults
#######################################################################
+if [ $(whoami) != "root" ]; then
+ echo "Sorry, you must be root for running $0"
+ exit 1
+fi
+
#######################################################################
# Default values
#######################################################################
dir_list="
/var/cache/escenic
+/var/backups/escenic
/var/crash/escenic
/var/log/escenic
+/var/lib/escenic
/var/run/escenic
"
ece_script=/usr/bin/ece
-# the values above may be overidden a file named the same as this
-# init.d script, located in:
+# The values above may be overidden a file named the same as this
+# init.d script. This init.d configuration must also hold the
+# variables controlling which ECE instances to start. The list of
+# locations per default caters (at least) for Debian, RedHat & Gentoo
+# based systems:
conf_file_location_list="
/etc/default
/etc/conf.d
-/tmp
+/etc/sysconfig
"
function read_conf_file()
{
for el in $conf_file_location_list; do
- if [ -r $el/`basename $0` ]; then
- source $el/`basename $0`
+ if [ -r $el/ece ]; then
+ source $el/ece
found_conf=1
break
fi
@@ -67,7 +77,12 @@ function ensure_dirs_are_ok()
if [ ! -d $el ]; then
mkdir -p $el
fi
- chown -R $ece_unix_user:$ece_unix_group $el
+
+ if [[ ${el} == "/var/cache"* || ${el} == "/var/lib"* ]]; then
+ chown --changes "${ece_unix_user-escenic}:${ece_unix_group-escenic}" $el
+ else
+ chown --recursive --changes "${ece_unix_user-escenic}:${ece_unix_group-escenic}" $el
+ fi
done
}
@@ -80,25 +95,25 @@ function ensure_ece_script_is_ok()
echo "$ece_script needs to be executable (do: chmod +x $ece_script)"
exit 1
fi
-
+
}
function execute_command()
{
- if [ $enable_rmi_hub = "true" ]; then
- su - $ece_unix_user -c "$ece_script -t rmi-hub $1"
+ if [ "${enable_rmi_hub-0}" -eq 1 ]; then
+ su - ${ece_unix_user-escenic} -c "$ece_script -t rmi-hub $1"
fi
-
+
for el in $engine_instance_list; do
- su - $ece_unix_user -c "$ece_script -t engine -i $el $1"
+ su - "${ece_unix_user-escenic}" -c "$ece_script -t engine -i $el $1"
done
-
+
for el in $search_instance_list; do
- su - $ece_unix_user -c "$ece_script -t search -i $el $1"
+ su - "${ece_unix_user-escenic}" -c "$ece_script -t search -i $el $1"
done
for el in $analysis_instance_list; do
- su - $ece_unix_user -c "$ece_script -t analysis -i $el $1"
+ su - "${ece_unix_user-escenic}" -c "$ece_script -t analysis -i $el $1"
done
}
diff --git a/etc/init.d/vosa b/etc/init.d/vosa
new file mode 100644
index 00000000..575c5009
--- /dev/null
+++ b/etc/init.d/vosa
@@ -0,0 +1,114 @@
+#! /usr/bin/env bash
+
+# version: $Revision: #1 $ $Date: 2011/02/18 $
+# author: mogsie@vizrt.com
+
+### BEGIN INIT INFO
+# Provides: vosa
+# 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: Vizrt Online Components
+### END INIT INFO
+
+#################################################################
+# Usage:
+# * copy this script to /etc/init.d/vosa
+#
+# * copy its configuration file to /etc/default/vosa (or
+# * /etc/conf.d/vosa on Gentoo based disitributions)
+#
+# * make sure it's executable, chmod +x /etc/init.d/vosa
+#
+# * add it to the desired runlevels. On Debian based systems this
+# would be: update-rc.d vosa defaults
+#######################################################################
+
+if [ $(whoami) != "root" ] ; then
+ echo "Sorry, you must be root to run $0"
+ exit 1
+fi
+
+#######################################################################
+# Default values
+#######################################################################
+dir_list="
+/var/run/vizrt/vosa
+"
+
+vosa_instance_list=
+for a in /etc/vizrt/vosa/enabled.d/* ; do
+ if [ -L "$a" -a -r "$a" ] ; then
+ vosa_instance_list="$vosa_instance_list $(basename "$a")"
+ fi
+done
+
+vosa_script=/usr/bin/vosa
+
+# The values above may be overidden a file named the same as this
+# init.d script. This init.d configuration must also hold the
+# variables controlling which vosa instances to start. The list of
+# locations per default caters (at least) for Debian, RedHat & Gentoo
+# based systems:
+conf_file_location_list="
+/etc/default
+/etc/conf.d
+/etc/sysconfig
+"
+
+function read_conf_file()
+{
+ for el in $conf_file_location_list; do
+ if [ -r $el/`basename $0` ]; then
+ source $el/`basename $0`
+ found_conf=1
+ break
+ fi
+ done
+
+# if [ -z $found_conf ]; then
+# echo "Couldn't find configuration for $0, exiting :-("
+# exit 1
+# fi
+}
+
+function ensure_dirs_are_ok()
+{
+ for el in $dir_list; do
+ if [ ! -d $el ]; then
+ mkdir -p $el
+ fi
+# don't change owner; root is fine...
+# chown --changes -R $vosa_unix_user:$vosa_unix_group $el
+ done
+}
+
+function ensure_vosa_script_is_ok()
+{
+ if [ ! -r $vosa_script ]; then
+ echo "Couldn't read $vosa_script"
+ exit 1
+ elif [ ! -x $vosa_script ]; then
+ echo "$vosa_script needs to be executable (do: chmod +x $vosa_script)"
+ exit 1
+ fi
+
+}
+
+function execute_command()
+{
+ for el in $vosa_instance_list; do
+ $vosa_script -i $el $1
+ done
+}
+
+if [ $1 ]; then
+ # todo: whitelist to start, stop, status.
+ read_conf_file
+ ensure_vosa_script_is_ok
+ ensure_dirs_are_ok
+ execute_command $1
+else
+ echo "Usage: `basename $0` "
+fi
diff --git a/etc/logrotate.d/tomcat b/etc/logrotate.d/tomcat
new file mode 100644
index 00000000..95e40834
--- /dev/null
+++ b/etc/logrotate.d/tomcat
@@ -0,0 +1,9 @@
+/var/log/escenic/*.out{
+ copytruncate
+ daily
+ rotate 7
+ compress
+ missingok
+ size 5M
+}
+
diff --git a/etc/munin/plugins/indexer_running b/etc/munin/plugins/indexer_running
new file mode 100755
index 00000000..405ce9f5
--- /dev/null
+++ b/etc/munin/plugins/indexer_running
@@ -0,0 +1,37 @@
+#!/bin/bash
+#
+
+#. $MUNIN_LIBDIR/plugins/plugin.sh
+info_file="/var/cache/periodic-check/indexer_running"
+state=$(cat $info_file | cut -f 3 -d ' ')
+age=$(cat $info_file | cut -f 4 -d ' ')
+
+if [ "$1" = "config" ]; then
+ echo 'graph_title indexing delay'
+ echo "graph_args --base 1000 -r --lower-limit 0 "
+ echo 'graph_vlabel Minutes'
+ echo 'graph_order indexing_delay'
+# echo 'graph_scale no'
+ echo 'graph_info Shows the time to get a document indexed by Escenic search. This is basically time difference between update time of head-tail file and entryUpdated field in SearchIndex table.'
+ echo 'graph_category system'
+ echo 'graph_period second'
+ echo "indexing_delay.label time to index current document"
+ echo "indexing_delay.draw LINE2"
+ echo "indexing_delay.min 0"
+ echo "indexing_delay.type GAUGE"
+ echo "indexing_delay.info time in $site in Bytes"
+ exit 0;
+fi
+
+# Note: Counters/derive need to report integer values. Also we need
+# to avoid 10e+09 and the like %.0f should do this.
+
+cur_epoch=$(date +%s)
+sample_epoch=$(cat "$info_file" | head -n 1| cut -f 1 -d ' ')
+#add 90 seconds to compensate freshness.
+sample_epoch=$(echo "$sample_epoch + 90"| bc)
+
+if [ "$sample_epoch" -gt "$cur_epoch" ] && [ "$state" == "yes" ] && [ "$age" -ge 0 ]; then
+ printf "indexing_delay.value $age\n"
+fi
+
diff --git a/etc/munin/plugins/site_length b/etc/munin/plugins/site_length
new file mode 100755
index 00000000..2c4ce04b
--- /dev/null
+++ b/etc/munin/plugins/site_length
@@ -0,0 +1,52 @@
+#!/bin/bash
+#
+
+#. $MUNIN_LIBDIR/plugins/plugin.sh
+info_file="/var/cache/periodic-check/site_length"
+sites=($(cat $info_file | cut -f 2 -d ' '))
+lengths=($(cat $info_file | cut -f 3 -d ' '))
+
+if [ "$1" = "autoconf" ]; then
+ if [ -r /proc/stat ]; then
+ echo yes
+ exit 0
+ else
+ echo no
+ exit 0
+ fi
+fi
+
+if [ "$1" = "config" ]; then
+
+ echo 'graph_title sites length'
+ echo "graph_order " ${sites[@]//./_}
+ echo "graph_args --base 1000 -r --lower-limit 0 "
+ echo 'graph_vlabel Bytes'
+# echo 'graph_scale no'
+ echo 'graph_info This graph shows length of different pages.'
+ echo 'graph_category system'
+ echo 'graph_period second'
+ for site in "${sites[@]}"; do
+ echo "${site//./_}.label $site"
+ echo "${site//./_}.draw LINE2"
+ echo "${site//./_}.min 0"
+ echo "${site//./_}.type GAUGE"
+ echo "${site//./_}.info length/size of $site in Bytes"
+ done
+ exit 0
+fi
+
+# Note: Counters/derive need to report integer values. Also we need
+# to avoid 10e+09 and the like %.0f should do this.
+
+cur_epoch=$(date +%s)
+sample_epoch=$(cat "$info_file" | head -n 1| cut -f 1 -d ' ')
+#add 90 seconds to compensate freshness.
+sample_epoch=$(echo "$sample_epoch + 90"| bc)
+
+if [ "$sample_epoch" -gt "$cur_epoch" ]; then
+ for i in $(seq 1 ${#sites[@]}); do
+ printf "%s.value %.0f\n" ${sites[$i-1]//./_} ${lengths[$i-1]}
+ done
+fi
+
diff --git a/etc/puppet/manifests/global-variables.pp b/etc/puppet/manifests/global-variables.pp
new file mode 100644
index 00000000..badaf59e
--- /dev/null
+++ b/etc/puppet/manifests/global-variables.pp
@@ -0,0 +1,13 @@
+# global variables
+$control_host = "control"
+
+$apt_vizrt_user = ""
+$apt_vizrt_password = ""
+$apt_proxy_host = "$control_host"
+
+$db_user = "ece5user"
+$db_vip = ""
+
+$privileged_ip_list = ""
+
+$mobilize_vip = ""
diff --git a/known-issues.org b/known-issues.org
new file mode 100644
index 00000000..31c64b2d
--- /dev/null
+++ b/known-issues.org
@@ -0,0 +1,26 @@
+#+TITLE: Known Issues
+#+AUTHOR: Escenic Cloud Team
+
+* ece-install
+** 2013-01-17 cron script removes all 15 day old files on the system
+- *Fixed in Version* :: 1.0-2013-01-17-468
+
+- *Versions affected* :: 1.0-2013-01-12-x => 1.0-2013-01-17-x
+
+If you have installed and run either the =ece-install= all-in-one,
+presentation or editorial profile between *2013-01-12*
+and *2013-01-17*, you have encountered this issue.
+
+If you have =escenic-content-engine-installer= of any of the versions
+affected, first remove the cron job if it's present:
+#+BEGIN_SRC sh
+# rm /etc/cron.daily/remove-old-escenic-cache-files
+#+END_SRC
+
+Then upgrade to the latest version of =ece-install= so that you're
+sure new runs of it will set up a proper cron job. If you're using
+our APT repository at apt.escenic.com, this as easy as:
+#+BEGIN_SRC sh
+# apt-get update
+# apt-get install escenic-content-engine-scripts
+#+END_SRC
diff --git a/usr/bin/ece b/usr/bin/ece
index 24575a55..acd98e55 100755
--- a/usr/bin/ece
+++ b/usr/bin/ece
@@ -4,22 +4,43 @@
# the RMI hub and the indexer standalone instances. Type "ece help"
# for a complete list of supported operations.
#
-# echo comments and suggestions > tkj@vizrt.com
+# echo comments and suggestions > torstein@escenic.com
+######################################################################
+# Needs to be here to bootstrap the ece script itself when it looks
+# for the ece[-[a-z0-9]*].conf files.
+#
+# There is one to avoid this bootstrap dependency, and that is to set
+# the ECE_CONF_LOCATIONS environment variable, however this is quite
+# uncommon and generally speaking not recommended.
+######################################################################
+escenic_conf_dir=/etc/escenic
######################################################################
# Script defaults, my be overriden in any of the configration files
######################################################################
-verbose=0
force_ipv4=0
+quiet=0
+everything_but_the_kitchen_sink=0
######################################################################
# Dear user, don't touch anyting in this script, especially below this
# line :-)
######################################################################
+ece_scripts_version="straight-from-github"
type=engine
-instance=default
+instance=engine1
command=""
+backup_exclude_binaries=0
+backup_exclude_conf=0
+backup_exclude_db=0
+backup_exclude_init=0
+backup_exclude_multimedia=0
+backup_exclude_solr=0
+backup_exclude_state=0
+wget_appserver_auth=""
+curl_appserver_auth=""
+log=""
type_list="
engine
@@ -27,13 +48,6 @@ search
rmi-hub
"
-common_settings_list="
-ece_home
-java_home
-log_dir
-pid_dir
-"
-
hub_required_fields="
ece_server_hostname
rmi_hub_conf
@@ -44,116 +58,125 @@ engine_required_fields="
appserver
assemblytool_home
cache_dir
+data_dir
+escenic_conf_dir
ece_home
ece_security_configuration_dir
enable_heap_dump
enable_remote_debugging
enable_remote_monitoring
-is_production
java_home
solr_home
+log_dir
+run_dir
+tmp_dir
"
search_required_fields="
appserver
java_home
solr_home
+tmp_dir
"
analysis_required_fields="
appserver
java_home
+tmp_dir
"
-####################################################################
-# Will exit the ece execution if the last operation failed. While
-# failing, it will print the message passed to the function.
-####################################################################
-function exit_on_error()
-{
- if [ $? -eq 1 ]; then
- print $1 "FAILED, exiting :-("
- exit 1
- fi
-}
-####################################################################
-# debug/verbose method
-####################################################################
-function debug()
-{
- if [ $verbose -eq 1 ]; then
- print $@
- fi
-}
-
-function print()
-{
- echo "$id" $@
-}
-
-function log()
-{
- echo "$id" `date` $@ 2>/dev/null >> $log_file
-}
-
-function verify_that_directory_and_file_are_writeable()
-{
- dir=`dirname $1`
- if [ ! -e $dir ]; then
- print $dir " doesn't exist"
- exit 1
- fi
- if [ ! -w $dir ]; then
- print $dir " isn't writable for user $USER"
- exit 1
- fi
+## Bootstrapping, load files from /usr/share/escenic/ece-scripts The
+## method will first try to be smart, in case the user has copied the
+## ece-scripts somewhere else., e.g.: moved everything to ~/ece-scrpts
+## or /opt/escenic/ece-scripts, this should also work.
+function init() {
+ # first, try to be nice
+ local dir=$(dirname $0)/../share/escenic/ece-scripts
+
+ # then check the standard location
+ if [ ! -d $dir ]; then
+ dir=/usr/share/escenic/ece-scripts
+ fi
+
+ if [ -d $dir ]; then
+ # load common libraries
+ common_libraries="common-bashing.sh common-io.sh common-os.sh common-ece.sh"
+ for el in $common_libraries; do
+ source $dir/${el}
+ done
- if [ -e $1 ]; then
- if [ ! -w $1 ]; then
- print $1 "exists, "
- print "but isn't write-able for user $USER"
- print "check the permissions and that $USER is the correct one"
- print "to run "`basename $0`
- exit 1
- fi
- fi
+ # load ece-install modules
+ for el in $dir/ece.d/*.sh; do
+ source $el
+ done
+ else
+ echo "I cannot find $(basename $0)'s dependencies, exiting :-("
+ exit 1
+ fi
}
####################################################################
# Ensures that all required fields are set. Will report all missing
# required fields before failing.
####################################################################
-function ensure_that_required_fields_are_set()
-{
+function ensure_that_required_fields_are_set() {
requirements_failed=0
-
+
for el in $@; do
if [ -n "$(eval echo $`echo $el`)" ]; then
continue
fi
-
- print "You need to specifiy '$el' in your `basename $0`.conf"
+
+ print "You need to specifiy '$el' in one of ${ece_conf_files_read[@]}"
requirements_failed=1
done
- if [ $requirements_failed -eq 1 ]; then
+ if [ "$requirements_failed" -eq 1 ]; then
exit 1
fi
}
-function read_conf_file()
-{
+ece_conf_files_read=()
+
+function read_conf_file() {
for el in $conf_file_location_list; do
if [ -r $el/$1 ]; then
debug "found $1 in $el, reading it"
source $el/$1
+ ece_conf_files_read=($el/$1 ${ece_conf_files_read})
break
fi
done
}
-function set_common_settings()
-{
+## If the system is installed using the recommended paths, the method
+## will return a list of the instances configured in
+## ${escenic_conf_dir}/ece-*.conf
+export root_allowed_list_instances=1
+function get_instance_list() {
+ local allowed_types="engine analysis changelogd search rmi-hub"
+ instance_list=""
+ for el in $(\ls /etc/escenic/ece-*.conf 2>/dev/null); do
+
+ local instance=$(basename $el .conf)
+ instance=${instance##ece-}
+
+ for ele in $allowed_types; do
+ if [[ $instance == $ele ]]; then
+ instance=""
+ continue
+ fi
+
+ local away="${ele}-"
+ instance=${instance##${away}}
+ done
+ instance_list="$instance_list $instance"
+ done
+
+ echo $instance_list
+}
+
+function set_common_settings() {
# This behaviour can be overridden by specifying a list of
# locations in the environment variable ECE_CONF_LOCATIONS
if [ -n "$ECE_CONF_LOCATIONS" ] ; then
@@ -161,43 +184,79 @@ function set_common_settings()
else
conf_file_location_list="
`dirname $0`
- /etc/escenic/$type/instance/$instance
- /etc/escenic/$type/host/`echo $HOSTNAME | tr '[A-Z]' '[a-z]'`
- /etc/escenic/$type/common
- /etc/escenic/$type
- /etc/escenic
+ ${escenic_conf_dir}/$type/instance/$instance
+ ${escenic_conf_dir}/$type/host/`echo $HOSTNAME | tr '[A-Z]' '[a-z]'`
+ ${escenic_conf_dir}/$type/common
+ ${escenic_conf_dir}/$type
+ ${escenic_conf_dir}
`dirname $0`/../etc
"
fi
# main configuration file, may be overridden in the type and
# instance specific ones.
- read_conf_file `basename $0`.conf
+ read_conf_file $(basename $0).conf
- if [ $instance = "default" ]; then
- log_file=$log_dir/$type.out
- pid_file=$pid_dir/$type.pid
- else
- log_file=$log_dir/$type-$instance.out
- pid_file=$pid_dir/$type-$instance.pid
- fi
+ log=$log_dir/$instance.out
+ pid_file=$run_dir/$instance.pid
+
+ gc_log=${log_dir}/${instance}-gc.log
- log_file_list="
+ log4j_file_list="
+ $log_dir/${HOSTNAME}-${instance}-messages
+ $log_dir/${instance}-messages
$log_dir/messages
$log_dir/Escenic-error.log
"
+}
+
+function set_type_settings() {
+ # optional: possible to have type specific conf file,
+ # will take precedences over the common one.
+ read_conf_file $(basename $0)-$type.conf
+}
+
+function set_type_pid() {
+ if [ "$(uname)" == "Linux" ]; then
+ ps_options="auxww"
+ else
+ ps_options="-ef"
+ fi
+
+ # Get a hold of the PID of the process. Although we've got the PID
+ # file, we stil get the PID from the OS here as we used it for
+ # sanity checking later on, see stop_type().
+ if [ "$type" == "rmi-hub" ]; then
+ # we need to be able to differentiate between an ECE instance
+ # and an rmi hub, for this we use java.security.policy which
+ # the hub doesn't have.
+ type_pid=`ps $ps_options | grep -v java.security.policy | \
+ awk "/Djava.rmi.server.hostname=$ece_server_hostname / && \
+ !/awk/"' {print $2}'`
+ else
+ type_pid=`ps $ps_options | awk "/Descenic.server=$ece_server / && !/awk/"' {print $2}'`
+ fi
+
+ debug "type_pid is now=$type_pid"
+}
+
+function set_type_port() {
host=localhost
- if [ $appserver != "tomcat" ]; then
+ # port set in ece[-instance].conf takes precedence
+ if [ -n "${appserver_port}" ]; then
+ port=${appserver_port}
+ debug "appserver_port set in .conf files=${port}"
+ elif [ "$appserver" != "tomcat" ]; then
debug "Only tomcat is supported for reading host/port right now, "
debug "trying to make an educated guess"
port=8080
else
if [ -r $tomcat_base/logs/catalina.out ]; then
# for tomcat6-user packaged tomcats (and perhaps others)
- out_log=$tomcat_base/logs/catalina.out
+ out_log=$log_dir/${instance_name}-tomcat-catalina.out
else
- out_log=$log_file
+ out_log=$log
fi
if [ -r $out_log ]; then
@@ -207,59 +266,34 @@ function set_common_settings()
cut -d'-' -f2
)
fi
-
fi
-
-}
-function set_type_settings()
-{
- # optional: possible to have type specific conf file,
- # will take precedences over the common one.
- read_conf_file `basename $0`-$type.conf
+ debug "set_type_port=$port"
}
-function set_type_pid()
-{
- # Get a hold of the PID of the process. Although we've got the PID
- # file, we stil get the PID from the OS here as we used it for
- # sanity checking later on, see stop_type().
- if [ $type = "rmi-hub" ]; then
- # we need to be able to differentiate between an ECE instance
- # and an rmi hub, for this we use java.security.policy which
- # the hub doesn't have.
- type_pid=`ps -ef | grep -v java.security.policy | \
- awk "/Djava.rmi.server.hostname=$ece_server_hostname / && \
- !/awk/"' {print $2}'`
- else
- type_pid=`ps -ef | awk "/Descenic.server=$ece_server / && !/awk/"' {print $2}'`
- fi
-
- debug "type_pid is now=$type_pid"
-}
-
-function set_instance_settings()
-{
+function set_instance_settings() {
# optional: possible to have instance specific conf files,
# these will take precedence over the other two
- read_conf_file `basename $0`-$instance.conf
- read_conf_file `basename $0`-$type-$instance.conf
+ read_conf_file $(basename $0)-$instance.conf
+ read_conf_file $(basename $0)-$type-$instance.conf
# at this point in the script flow, we have now read all the
# possible combinations of conf files (common, type and instance)
# and can now ensure that required fields are set and apply them.
- if [ $type = "rmi-hub" ]; then
+ if [ "$type" == "rmi-hub" ]; then
ensure_that_required_fields_are_set $hub_required_fields
- elif [ $type = "search" ]; then
+ elif [ "$type" == "search" ]; then
ensure_that_required_fields_are_set $search_required_fields
- elif [ $type = "engine" ]; then
+ elif [ "$type" == "engine" ]; then
ensure_that_required_fields_are_set $engine_required_fields
+ elif [ "$type" == "analysis" ]; then
+ ensure_that_required_fields_are_set $analysis_required_fields
fi
# We respect ece_server if it's set in any of the configuration
# files. If it's not set there, it sets some sensible defaults.
- if [ -z $ece_server ]; then
- if [ $instance = "default" ]; then
+ if [ -z "$ece_server" ]; then
+ if [ "$instance" == "engine1" ]; then
ece_server=${HOSTNAME}
else
ece_server=${HOSTNAME}-${instance}
@@ -267,9 +301,9 @@ function set_instance_settings()
fi
set_type_pid
-
+
# if type is rmi-hub, we don't' need more configuration.
- if [ $type = "rmi-hub" ]; then
+ if [ "$type" == "rmi-hub" ]; then
return
fi
@@ -282,74 +316,118 @@ function set_instance_settings()
# * java.awt.headless is to avoid potential problems with graphics
# handling/generation, causing 0x0 bitmaps etc.
# * java.security for configuring the Java security framework with ECE.
- ece_args="-Descenic.server=$ece_server\
- -Dsolr.solr.home=$solr_home\
- -Djava.awt.headless=true\
- -Djava.security.auth.login.config=$ece_security_configuration_dir/jaas.config\
- -Djava.security.policy=$ece_security_configuration_dir/java.policy"
-
- if [ $instance != "default" ]; then
- ece_args=$ece_args" -Dcom.escenic.instance=$instance"
+ # * garbage collection log: this is paramount to keep an eye on
+ # when running in production.
+ ece_args="
+ -Descenic.server=$ece_server
+ -Dcom.escenic.instance=$instance
+ -Djava.awt.headless=true
+ -Djava.security.auth.login.config=$ece_security_configuration_dir/jaas.config
+ -Djava.security.policy=$ece_security_configuration_dir/java.policy
+ -Dsolr.solr.home=$solr_home
+ -XX:+PrintGCDetails
+ -XX:+PrintGCTimeStamps
+ -Xloggc:${gc_log}
+ "
+
+ if [ "$jvm_gc_settings" ]; then
+ ece_args=$ece_args" "$jvm_gc_settings
fi
- if [ $ece_server_hostname ]; then
+ jvm_rolling_gc=${jvm_rolling_gc-1}
+ if [ "$jvm_rolling_gc" == 1 ]; then
+ gc_rolling_args="
+ -XX:+UseGCLogFileRotation
+ -XX:NumberOfGCLogFiles=${number_of_gc_log_files-5}
+ -XX:GCLogFileSize=${gc_log_file_size-5m}
+ "
+ ece_args=$ece_args" "$gc_rolling_args
+ fi
+
+ if [ "$jvm_proxy_settings" ]; then
+ ece_args=$ece_args" "$jvm_proxy_settings
+ fi
+
+ if [ "$jvm_connection_settings" ]; then
+ ece_args=$ece_args" "$jvm_connection_settings
+ fi
+
+ if [ -n "$ece_environment" ]; then
+ ece_args=$ece_args" -Dcom.escenic.environment=${ece_environment}"
+ fi
+
+ if [ "$ece_server_hostname" ]; then
ece_args=$ece_args" -Djava.rmi.server.hostname=$ece_server_hostname"
fi
- if [ $apr_lib_dir ]; then
+ if [ "$apr_lib_dir" ]; then
ece_args=$ece_args" -Djava.library.path=$apr_lib_dir"
fi
- if [ $min_heap_size ]; then
+ if [ "$min_heap_size" ]; then
ece_args=$ece_args" -Xms$min_heap_size"
fi
- if [ $max_heap_size ]; then
+ if [ "$max_heap_size" ]; then
ece_args=$ece_args" -Xmx$max_heap_size"
fi
- if [ $min_permgen_size ]; then
+ if [ "$min_permgen_size" ]; then
ece_args=$ece_args" -XX:PermSize=$min_permgen_size"
fi
- if [ $max_permgen_size ]; then
+ if [ "$max_permgen_size" ]; then
ece_args=$ece_args" -XX:MaxPermSize=$max_permgen_size"
fi
-
- # settings specific to a production environment
- if [ $is_production -eq 1 ]; then
- ece_args=$ece_args" -server"
- fi
-
- if [ $jvm_encoding ]; then
+
+ if [ "$jvm_encoding" ]; then
ece_args=$ece_args" -Dsun.jnu.encoding=$jvm_encoding"
ece_args=$ece_args" -Dfile.encoding=$jvm_encoding"
fi
- if [ $enable_remote_debugging -eq 1 ]; then
+ if [ "$analysis_conf_dir" ]; then
+ ece_args=$ece_args" -Dcom.escenic.eae.config=${analysis_conf_dir}"
+ fi
+
+ if [ "$enable_remote_debugging" -eq 1 ]; then
ece_args=$ece_args" -Xdebug -Xnoagent -Djava.compiler=NONE \
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$remote_debugging_port"
- fi
+ fi
- if [ $enable_remote_monitoring -eq 1 ]; then
+ if [ "$enable_remote_monitoring" -eq 1 ]; then
ece_args=$ece_args" -Dcom.sun.management.jmxremote"
ece_args=$ece_args" -Dcom.sun.management.jmxremote.authenticate=false"
ece_args=$ece_args" -Dcom.sun.management.jmxremote.ssl=false"
- ece_args=$ece_args" -Dcom.sun.management.jmxremote.port=$remote_monitoring_port"
+ ece_args=$ece_args" -Dcom.sun.management.jmxremote.port=$remote_monitoring_port"
fi
- if [ $enable_heap_dump -eq 1 ]; then
+ if [ "$enable_heap_dump" -eq 1 ]; then
ece_args=$ece_args" -XX:+HeapDumpOnOutOfMemoryError"
ece_args=$ece_args" -XX:HeapDumpPath=$heap_dump_dir"
fi
- if [ $force_ipv4 -eq 1 ]; then
+ if [ "$force_ipv4" -eq 1 ]; then
ece_args=$ece_args" -Djava.net.preferIPv4Stack=true"
fi
-
+
+ if [[ -n "$escenic_admin_http_user" && -n "$escenic_admin_http_password" ]]; then
+ wget_appserver_auth="
+ --http-user $escenic_admin_http_user
+ --http-password $escenic_admin_http_password
+ "
+ curl_appserver_auth="-u ${escenic_admin_http_user}:${escenic_admin_http_password}"
+ fi
+
+ if [[ -n "$builder_http_user" && -n "$builder_http_password" ]]; then
+ wget_builder_auth="
+ --http-user $builder_http_user
+ --http-password $builder_http_password
+ "
+ fi
+
# Resin needs some more arguments as its XML parser is not
# compatible with ECE.
- if [ $appserver = "resin" ]; then
+ if [[ "$appserver" == "resin" ]]; then
ece_args="$ece_args\
-Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser
-Djavax.xml.stream.XMLInputFactory=com.sun.xml.stream.ZephyrParserFactory
@@ -358,8 +436,8 @@ function set_instance_settings()
-Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl"
debug "resin_home=$resin_home"
- elif [ $appserver = "tomcat" ]; then
- if [ -z $tomcat_base ]; then
+ elif [ "$appserver" == "tomcat" ]; then
+ if [ -z "$tomcat_base" ]; then
tomcat_base=$tomcat_home
else
export CATALINA_BASE=$tomcat_base
@@ -371,706 +449,369 @@ function set_instance_settings()
export ECE_HOME=$ece_home
export JAVA_OPTS="$JAVA_OPTS $ece_args"
export JAVA_HOME=$java_home
-
+
debug ECE_HOME=$ECE_HOME
debug JAVA_HOME=$JAVA_HOME
debug JAVA_OPTS=$JAVA_OPTS
-
}
-function sanity_check()
-{
- verify_that_directory_and_file_are_writeable $log_file
- verify_that_directory_and_file_are_writeable $pid_file
-
- if [ -z "$command" ]; then
- print "You must specificy a command, see 'ece help'."
- exit 1
- fi
-}
-
-function deploy()
-{
- ear=$cache_dir/engine.ear
- if [ ! -e $ear ]; then
- print "$ear does not exist. Did you run '"`basename $0`" assemble'?"
- exit 1
- fi
-
- # extract EAR to a temporary area
- dir=$tmp_dir/`basename $0`-`date +%s`
- (mkdir -p $dir && cd $dir && jar xf $ear)
- exit_on_error "extracting $ear to $dir"
-
- print "Deploying $ear on $appserver ..."
-
- case $appserver in
- tomcat)
- # We do not want the Escenic jars to share the same
- # classloader folder as tomcat does We thereby want
- # clients to use a separate escenic classloader to avoid
- # strange upgrade problems i.e wrong versions of certain
- # libraries.
- if [ -d $tomcat_base/escenic/lib ]; then
- if [ `ls $tomcat_base/escenic/lib | grep .jar | wc -l` -gt 0 ]; then
- rm $tomcat_base/escenic/lib/*.jar
- exit_on_error "removing previous deployed libraries"
- fi
- cp $dir/lib/*.jar \
- $tomcat_base/escenic/lib \
- 1>>$log_file \
- 2>>$log_file
- exit_on_error "deploying jar files to $tomcat_base/escenic/lib"
- else
- print "Could not find $tomcat_base/escenic/lib. Exiting."
- print "Also make sure that you have defined this directory in"
- print " $tomcat_base/conf/catalina.properties"
- print "see sample configuration in the engine distribution"
- print " contrib/appserver/tomcat/catalina-sample.properties"
- exit 1
- fi
-
- exit_on_error "copying lib files to app server classpath"
-
- rm -rf $tomcat_base/work/* \
- 1>>$log_file \
- 2>>$log_file
-
- exit_on_error "removing work files from tomcat"
-
- for war in $dir/*.war ; do
- if [ -d $tomcat_base/webapps/`basename $war .war` ] ; then
- rm -rf $tomcat_base/webapps/`basename $war .war` \
- 1>>$log_file \
- 2>>$log_file
- exit_on_error "removing already deployed escenic wars in $tomcat_base/webapps/"
- fi
- done
-
- # this scenario is likely when running many minimal
- # instances of tomcat and some of these are not properly
- # initialised.
- if [ ! -d $tomcat_base/webapps ]; then
- print $tomcat_base/webapps "doesn't exist, exiting."
- exit 1
- fi
-
- if [ -n "$deploy_webapp_white_list" ]; then
- deploy_this_war=0
- message="Deployment white list active, only deploying: "
- message=$message"$deploy_webapp_white_list"
- print $message
- log $message
+function sanity_check() {
+ if [ "$(whoami)" == "root" ]; then
+ local next_is_ok=0
+ for subcommand in ${command}; do
+ # ignore options, i.e. things starting with a hyphen.
+ if [[ "${subcommand}" =~ ^-.* ]]; then
+ # Allow values to options, must use this since not
+ # everything is using getopt (yet)
+ next_is_ok=1
+ continue
fi
-
- for war in $dir/*.war ; do
- name=`basename $war .war`
-
- deploy_this_war=1
- if [ -n "$deploy_webapp_white_list" ]; then
- deploy_this_war=0
-
- for el in $deploy_webapp_white_list; do
- if [ $el = $name ]; then
- debug "found $war in white list, will deploy it"
- deploy_this_war=1
- fi
- done
- fi
-
- if [ $deploy_this_war -eq 0 ]; then
- continue
- fi
-
- (cd $tomcat_base/webapps &&
- mkdir $name &&
- cd $name &&
- jar xf $war \
- 1>>$log_file \
- 2>>$log_file)
- exit_on_error "extracting $war to $tomcat_base/webapps/"
- done
- ;;
-
- resin)
- if [ ! -d $resin_home/deploy ]; then
- mkdir -p $resin_home/deploy \
- 1>>$log_file \
- 2>>$log_file
- fi
- cp $ear $resin_home/deploy \
- 1>>$log_file \
- 2>>$log_file
- ;;
- *)
- print "Deployment is only implemented for Resin and Tomcat so far."
- ;;
- esac
-}
-
-
-function start_type()
-{
- unset CLASSPATH
- message="Starting the $instance instance of $type on $HOSTNAME ..."
- print $message
- log $message
-
- if [ $type = "rmi-hub" ]; then
- ensure_that_required_fields_are_set $hub_required_fields
-
- if [ -r $rmi_hub_conf ]; then
- export CLASSPATH=$rmi_hub_conf:$CLASSPATH
- else
- print $rmi_hub_conf "must point to a valid Nursery configuration"
- print "for the rmi-hub, you may copy the one found in"
- print "$ece_home/contrib/rmi-hub/config."
- print "Exiting :-("
- exit 1
- fi
-
- for el in $rmi_hub_home/lib/*.jar; do
- export CLASSPATH=$CLASSPATH:$el
- done
-
- $java_home/bin/java \
- -Djava.rmi.server.hostname=${ece_server_hostname} \
- neo.nursery.GlobalBus /Initial \
- 1>>$log_file \
- 2>>$log_file & pid=$!
-
- echo $pid > $pid_file
- exit 0
- elif [ $type = "search" ]; then
- # TODO trim & tun the default parameters for the search
- # instance.
- ensure_that_required_fields_are_set $engine_required_fields
- elif [ $type = "engine" ]; then
- ensure_that_required_fields_are_set $engine_required_fields
- elif [ $type = "analysis" ]; then
- ensure_that_required_fields_are_set $analysis_required_fields
- fi
-
- # indexer and engine are treated the same
- case $appserver in
- tomcat)
- # Tomcat respects JAVA_OPTS set in configure(), so no need
- # to set them here.
-
- if [ ! -x $tomcat_home/bin/catalina.sh ]; then
- print "$tomcat_home/bin/catalina.sh was not executable"
- print "unable to start tomcat"
- exit 1
+ if [ ${next_is_ok-0} -eq 1 ]; then
+ next_is_ok=0
+ continue
fi
- # We call run here to get the log output to the stdout log
- $tomcat_home/bin/catalina.sh run \
- 1>>$log_file \
- 2>>$log_file & pid=$!
- ;;
- oc4j)
- export OC4J_JVM_ARGS=$ece_args
- $oc4j_home/bin/oc4j -start\
- 1>>$log_file\
- 2>>$log_file & pid=$!
- ;;
- resin)
- # Resin has stared insisting on a -J prefix of the -D
- # prefixes :-) Tested with Resin 3.0.25
- resin_ece_args=`echo $ece_args | sed 's/-D/-J-D/g'`
-
- # works for Resin 3.0
- if [ -e $resin_home/bin/wrapper.pl ]; then
- exec perl $resin_home/bin/wrapper.pl \
- -chdir \
- -name httpd \
- -class com.caucho.server.resin.Resin \
- $resin_ece_args ${1+"$@"} \
- 1>>$log_file \
- 2>>$log_file & pid=$!
- else
- # works for Resin 3.1
- $java_home/bin/java $ece_args \
- -jar $resin_home/lib/resin.jar \
- start \
- 1>>$log_file \
- 2>>$log_file & pid=$!
- fi
- ;;
- jboss)
- $jboss_home/bin/run.sh \
- -b 0.0.0.0 \
- -c $jboss_conf \
- 1>>$log_file \
- 2>>$log_file & pid=$!
- ;;
- *)
- echo "" # extra line feed, because of the echo -n above
- print "No appserver is defined in $ece_conf"
- exit 1
- esac
-
- if [ $pid ]; then
- verify_that_directory_and_file_are_writeable $pid_file
- echo $pid > $pid_file
+ declare | grep -q -w root_allowed_${subcommand//-/_} || {
+ print "Sorry, you cannot be root when running " \
+ "'${BASH_SOURCE[0]##*/} ${subcommand}'." \
+ "root can only use /etc/init.d/ece"
+ exit 1
+ }
+ done
fi
-
- exit_on_error $message
-}
-function stop_type()
-{
- message="Stopping the $instance instance of $type on $HOSTNAME ..."
-
- if [ -n "$type_pid" ]; then
- log $message
- print $message
-
- if [ -r $pid_file ]; then
- if [ "$type_pid" != "`cat $pid_file`" ]; then
- print "Is running, but was not started with `basename $0`"
- print "system PID $ece_pid differs from the PID in $pid_file"
- print "removing dangling PID file $pid_file. "
- print "In future, be sure to use $0 to start "
- print "and stop your $type"
- kill $type_pid 1>>$log_file 2>>$log_file
- rm $pid_file
- return
- fi
- fi
-
- kill $type_pid \
- 1>>$log_file \
- 2>>$log_file
-
- if [ -e $pid_file ]; then
- rm $pid_file \
- 1>>$log_file \
- 2>>$log_file
- fi
- else
- print "The $instance instance of $type on $HOSTNAME is NOT running"
+ if [ "$(echo $command)" == "list-instances" ]; then
+ return
fi
-
- exit_on_error $message
-}
-function kill_type()
-{
- if [ -n "$type_pid" ]; then
- message="Using force to stop the $instance instance of $type on $HOSTNAME ..."
- log $message
- print $message
- kill -9 $type_pid
- if [ -w $pid_file ]; then
- rm $pid_file
- fi
- else
- print "No $instance instance of $type on $HOSTNAME to be killed"
- fi
-
- exit_on_error "kill_type"
-}
+ verify_that_directory_and_file_are_writeable $log
+ verify_that_directory_and_file_are_writeable $pid_file
-function restart_type()
-{
- stop_type
-
- # I've tested this with various values, 8 seconds seems to
- # guarantee that the previous JVM process has stopped
- # properly before starting the new one.
- sleep 8
-
- # sometimes the JVM refuses to shot down when doing a graceful
- # kill, therefore, if it's still running after the sleep above, we
- # use brute force to kill it.
- set_type_pid
- if [ -n "$type_pid" ]; then
- message="The $instance instance of $type failed to stop gracefully"
- debug $message
- log $message >> $log_file
- print $message
- kill_type
- fi
-
- start_type
-}
-
-function assemble()
-{
- if [ ! $type = "engine" ]; then
- print "You cannot assemble $type"
+ if [ -z "$command" ]; then
+ print "You must specificy a command, see 'ece help'."
exit 1
fi
- message="Assembling your EAR file ..."
- print $message
- log $message >> $log_file
-
- cd $assemblytool_home && \
- ant -q ear -DskipRedundancyCheck=true \
- 1>>$log_file \
- 2>>$log_file
- exit_on_error "$message"
-
- mkdir -p $ear_cache_dir/
- exit_on_error "creating $ear_cache_dir"
-
- cp $assemblytool_home/dist/engine.ear $cache_dir
- exit_on_error "copying ear to $ear_cache_dir"
-
- debug $assemblytool_home/dist/engine.ear "is now ready"
-}
-
-function tail_messages_log()
-{
- for el in $log_file_list; do
- if [ -r $el ]; then
- print "tailing $el"
- tail -f $el
- break
- fi
+ local instance_list=$(get_instance_list)
+ local instance_exists=0
+ for el in $instance_list; do
+ if [ $el == $instance ]; then
+ instance_exists=1
+ break
+ fi
done
-}
-function tail_out_log()
-{
- tail_list=$log_file
-
- # if needs be, we can add more system out logs here. For now,
- # we're sticking with the default one.
-
- print "Tailing the system out log $tail_list"
- tail -f $tail_list
-}
+ if [ $instance_exists -eq 0 ]; then
+ print "Instance '$instance' doesn't exist on $HOSTNAME"
+ exit 1
+ fi
-function tail_app_log()
-{
- if [ $type = "rmi-hub" ]; then
- print "There is no application server log for $type"
+ # verifies that java_home exists and has the java executable
+ if [ ! -d $java_home ]; then
+ print "java_home $java_home doesn't exist"
+ print "check your setting in one of: ${ece_conf_files_read[@]}"
exit 1
- fi
-
- if [ $appserver = "tomcat" ]; then
- log_file=$tomcat_base/logs/localhost.`date +%F`.log
- elif [ $appserver = "resin" -a -e $resin_home/log/jvm-default.log ]; then
- log_file=$resin_home/log/jvm-default.log
- else
- print "I don't know where the logs for $appserver are."
- print "Ask support@escenic.com to add support for $appserver in "
- print "tail_app_log()"
+ elif [ ! -x $java_home/bin/java ]; then
+ print "$java_home/bin/java isn't executable for $ece_user"
exit 1
fi
-
- print "Tailing the application server log $log_file"
- tail -f $log_file
}
-function make_thread_dump()
-{
-
- if [ -n "$type_pid" ]; then
- print "Thread dump (PID" $type_pid") written to system out log."
- print "Type 'ece -t $type -i default outlog' to see it or view"
- print $log_file "directly."
+# Returns the file (can be a directory) passed to the function only
+# if it's the actual file/directory and not a link to it. If the
+# passed file is a link, the link target is returned instead.
+#
+# $1 - the file (which could be a link)
+function get_actual_file() {
+ if [ -h ${1} ]; then
+ dir=$(dirname $1)
+ real_file=$(ls -l ${1} | awk '{print $11}')
+
+ # Because of the test if the file we want to returns is
+ # absolute, we go to the root before testing. We want to
+ # preserve the cwd, therefore, we're doing the "cd /" in a
+ # subshell.
+ real_file=$(
+ cd /
+ if [ ! -e ${real_file} ]; then
+ real_file=${dir}/${real_file}
+ fi
- if [ -x $java_home/bin/jstack ]; then
- jstack -l $type_pid >> $log_file
- else
- kill -QUIT $type_pid >> $log_file
- fi
+ # this is the return value from the sub process
+ echo ${real_file}
+ )
else
- get_status
+ real_file=${1}
fi
+
+ echo ${real_file}
}
-function set_type_command_and_instance()
-{
- next_is_type=0
- next_is_instance=0
- next_is_publication=0
- next_is_resource=0
-
+function set_type_command_and_instance() {
+ local next_is_type=0
+ local next_is_instance=0
+ local next_is_publication=0
+ local next_is_resource=0
+ local next_is_http_user=0
+ local next_is_http_password=0
+ local next_is_file=0
+
for el in $@; do
- if [ $el = "-v" -o $el = "--verbose" ]; then
- verbose=1
+ if [ "$el" == "-v" -o "$el" == "--verbose" ]; then
+ debug=1
+ continue
+ fi
+
+ if [ "$el" == "--full" ]; then
+ everything_but_the_kitchen_sink=1
continue
fi
- if [ $el = "--help" ]; then
+
+ if [ "$el" == "-f" -o $el == "--file" -o $el == "--uri" ]; then
+ next_is_file=1
+ continue
+ fi
+
+ if [ "$el" == "-q" -o $el == "--quiet" ]; then
+ quiet=1
+ continue
+ fi
+
+ if [ "$el" == "--help" ]; then
command=help
continue
fi
- if [ $next_is_type -eq 1 ]; then
+ if [ "$next_is_file" -eq 1 ]; then
+ file=$el
+ next_is_file=0
+ continue
+ fi
+
+ if [ "$next_is_type" -eq 1 ]; then
type=$el
next_is_type=0
continue
fi
-
- if [ $next_is_instance -eq 1 ]; then
+
+ if [ "$next_is_http_user" -eq 1 ]; then
+ http_user=$el
+ next_is_http_user=0
+ continue
+ fi
+
+ if [ "$next_is_http_password" -eq 1 ]; then
+ http_password=$el
+ next_is_http_password=0
+ continue
+ fi
+
+ if [ "$next_is_instance" -eq 1 ]; then
instance=$el
next_is_instance=0
continue
fi
-
- if [ $next_is_publication -eq 1 ]; then
+
+ if [ "$next_is_publication" -eq 1 ]; then
publication=$el
next_is_publication=0
continue
fi
-
- if [ $next_is_resource -eq 1 ]; then
+
+ if [ "$next_is_resource" -eq 1 ]; then
resource=$el
next_is_resource=0
continue
fi
-
- if [ $el = "-t" -o $el = "--type" ]; then
+
+ if [ "$el" == "-t" -o "$el" == "--type" ]; then
next_is_type=1
continue
else
next_is_type=0
fi
- if [ $el = "-i" -o $el = "--instance" ]; then
+ if [ "$el" == "-i" -o "$el" == "--instance" ]; then
next_is_instance=1
continue
else
next_is_instance=0
fi
- if [ $el = "-p" -o $el = "--publication" ]; then
+ if [ "$el" == "-p" -o "$el" == "--publication" ]; then
next_is_publication=1
continue
else
next_is_publication=0
fi
-
- if [ $el = "-r" -o $el = "--publication-resource" ]; then
+
+ if [ "$el" == "-r" -o "$el" == "--publication-resource" ]; then
next_is_resource=1
continue
else
next_is_resource=0
fi
-
+
+ if [ "$el" == "-u" -o "$el" == "--user" ]; then
+ next_is_http_user=1
+ continue
+ else
+ next_is_http_user=0
+ fi
+
+ if [ "$el" == "-w" -o "$el" == "--password" ]; then
+ next_is_http_password=1
+ continue
+ else
+ next_is_http_password=0
+ fi
+
+ if [ "$el" == "--exclude-binaries" ]; then
+ backup_exclude_binaries=1
+ continue
+ elif [ "$el" == "--exclude-solr" ]; then
+ backup_exclude_solr=1
+ continue
+ elif [ "$el" == "--exclude-conf" ]; then
+ backup_exclude_conf=1
+ continue
+ elif [ "$el" == "--exclude-multimedia" ]; then
+ backup_exclude_multimedia=1
+ continue
+ elif [ "$el" == "--exclude-db" ]; then
+ backup_exclude_db=1
+ continue
+ elif [ "$el" == "--exclude-init" ]; then
+ backup_exclude_init=1
+ continue
+ elif [ "$el" == "--exclude-state" ]; then
+ backup_exclude_state=1
+ continue
+ elif [ "$el" == "--version" -o "$el" == "-V" ]; then
+ echo "Version:" $ece_scripts_version
+ exit 0
+ fi
+
# the only thing left at this point, is the command
- command="$command $el"
+ if [ -n "${command}" ]; then
+ command="$command $el"
+ else
+ command=${el}
+ fi
done
-}
-
-function clean_up()
-{
- if [ $type = "engine" ]; then
- print "Cleaning up generated files in $assemblytool_home ..."
- cd $assemblytool_home
- ant clean \
- 1>>$log_file \
- 2>>$log_file
- fi
- tmp_dir_prefix="`basename $0`-"
- if [ `ls $tmp_dir | grep $tmp_dir_prefix | wc -l` -gt 0 ]; then
- print "Cleaning up generated files in $tmp_dir ..."
- rm -rf $tmp_dir/$tmp_dir_prefix-[0-9]* \
- 1>>$log_file \
- 2>>$log_file
- fi
-
- if [ -e /var/cache/escenic/ -a \
- `ls /var/cache/escenic | grep ece- | wc -l` -gt 0 ]; then
- print "Cleaning up "`basename $0`" files in /var/cache/escenic/ ..."
- rm -rf /var/cache/escenic/* \
- 1>>$log_file \
- 2>>$log_file
+ # If the user didn't specify which instance to use and if there's
+ # only one available instance, use that instead of asking the user
+ # to provide it in sanity_check.
+ if [ "$instance" == "engine1" ]; then
+ debug "Trying to determine instance name"
+ local instance_list=$(get_instance_list)
+
+ if [ $(echo $instance_list | grep ' ' | wc -l) -eq 0 ]; then
+ instance=$instance_list
+ if [ -z "$instance" ] ; then
+ instance=engine1
+ fi
+ debug "setting instance=$instance as there's only one"
+ fi
fi
-
}
-function set_id()
-{
- if [ $instance = "default" ]; then
- id="["`basename $0`"#${type}]"
- else
- id="["`basename $0`"#${type}-${instance}]"
- fi
-
+function set_id() {
+ id="["$(basename $0)"#${type}-${instance}]"
+
debug type is $type \
and command is $command \
and instance is $instance
}
-function get_status()
-{
+function get_status() {
if [ -z "$type_pid" ]; then
- print "DOWN"
+ echo "DOWN"
exit 0
elif [ -r $pid_file ]; then
-
+
if [ "$type_pid" != `cat $pid_file` ]; then
- print "Is running, but was not started with `basename $0`"
- print "system PID $ece_id differs from the PID in $pid_file"
+ echo "Is running, but was not started with $(basename $0)"
+ echo "system PID $ece_id differs from the PID in $pid_file"
exit 1
fi
else
- print $pid_file "did not exist, "
- print "the ${instance} instance of ${type} is running with PID $type_pid"
- print "but hasn't been started properly with `basename $0`"
+ echo $pid_file "did not exist, "
+ echo "the ${instance} instance of ${type} is running with PID $type_pid"
+ echo "but hasn't been started properly with $(basename $0)"
exit 1
fi
- now=`date +%s`
- started=`stat -c %Y $pid_file`
- seconds=$(( now - started ))
- days=$(( seconds / ( 60 * 60 * 24 ) ))
- seconds_left=$(( seconds - ( $days * 60 * 60 * 24 ) ))
- hours=$(( seconds_left / ( 60 * 60 ) ))
- seconds_left=$(( seconds_left - ( $hours * 60 * 60 ) ))
- minutes=$(( seconds_left / 60 ))
- seconds_left=$(( seconds_left - $minutes * 60 ))
-
- print "UP" ${days}d ${hours}h ${minutes}m ${seconds_left}s
+ local now=`date +%s`
+ local started=`stat -c %Y $pid_file`
+ local seconds=$(( now - started ))
+ local days=$(( seconds / ( 60 * 60 * 24 ) ))
+ local seconds_left=$(( seconds - ( $days * 60 * 60 * 24 ) ))
+ local hours=$(( seconds_left / ( 60 * 60 ) ))
+ local seconds_left=$(( seconds_left - ( $hours * 60 * 60 ) ))
+ local minutes=$(( seconds_left / 60 ))
+ local seconds_left=$(( seconds_left - $minutes * 60 ))
+
+ echo "UP" ${days}d ${hours}h ${minutes}m ${seconds_left}s
}
-function list_versions()
-{
- if [ -z "$type_pid" ]; then
- print "$instance instance of $type on $HOSTNAME is NOT running"
- exit 1
+function read_rc_file_if_present() {
+ local rc_file=$HOME/.ecerc
+ if [ -r $rc_file ]; then
+ source $rc_file
fi
-
- version_manager=escenic-admin/browser/Global/neo/io/managers/VersionManager
- url=http://$host:$port/$version_manager
-
- print "Installed on the ${type} running on ${host}:${port} is:"
- wget -O - $url 2>/dev/null | \
- grep "\[\[" | \
- sed 's/\[//g' | \
- sed 's/\]//g' | \
- sed 's/Name\=io/Name\=content-engine/g' | \
- sed 's/Name\=//g' | \
- sed 's/\;\ Version\=/\ /g' | \
- awk -F',' '{for (i = 1; i <= NF; i++) print " * " $i;}' | \
- # This is a hack since that for some reason, cannot get
- # sub(/^[ \t]+/, "") to work inside the loop for $i, it seems
- # to always operate on the incoming line.
- sed 's/\*\ \ \ /\*/g' | \
- sort
}
-function update_publication_resources()
-{
- url=http://${host}:${port}/escenic-admin/publication-resources
+function get_escenic_admin_url() {
+ set_type_port
+ local url=http://${host}:${port}/escenic-admin
+ echo ${url}
+}
- if [ ! -r $resource ]; then
- print $resource "doesn't exist. I will exit :-("
- exit 1
- fi
+export root_allowed_list_publications=1
+function show_all_publications() {
+ set_type_port
+ print "These are all the publications on ${instance}:"
+ get_publication_list ${port}
+}
- if [ -x $publication ]; then
- print "You must specify which publication to update (-p )"
- exit 1
- fi
-
- case "$(basename $resource)" in
- content-type)
- url=${url}/${publication}/escenic/content-type
- ;;
- feature)
- url=${url}/${publication}/escenic/feature
- ;;
- layout)
- url=${url}/${publication}/escenic/layout
- ;;
- layout-group)
- url=${url}/${publication}/escenic/layout-group
- ;;
- image-version)
- url=${url}/${publication}/escenic/image-version
- ;;
- menu)
- url=${url}/${publication}/escenic/plugin/menu
- ;;
-
- *)
- print "Invalid resource: $(basename $resource) :-("
- exit 1
-
- esac
-
- print "Updating the $(basename $resource) resource for the $publication" \
- "publication"
-
- debug POSTing $resource to $url
- wget -O - \
- --post-file ${resource} \
- $url \
- 1>>$log_file 2>>$log_file
-
+function show_all_deployments() {
+ print "These are all the deployments on ${instance}:"
+ cat $(get_deployment_log)
+}
+
+## $1 :: command
+## $..n :: the rest of the arguments passed to /usr/bin/ece
+function lookup_and_execute_dynamic_command_if_found() {
+ local command=$1
+ local requested_cmd=cmd_${command//-/_}
+ local actual_cmd=
+ actual_cmd=$(declare -F | grep -w "${requested_cmd}" | cut -d' ' -f3)
+ if [ -n "${actual_cmd}" ]; then
+ shift 1
+ "${actual_cmd}" "$@"
+ exit 0
+ fi
}
-set_type_command_and_instance $@
+init
+read_rc_file_if_present
+set_type_command_and_instance "$@"
set_id
set_common_settings
set_type_settings
set_instance_settings
sanity_check
-function print_help()
-{
- echo "Usage: $0 [-t ] [-i ] "
- echo ""
- echo "DESCRIPTION"
- echo " -t --type "
- echo " The following types are available:"
- echo " engine - The Escenic Content Engine, this is the default"
- echo " and is the assumed type if none is specified."
- echo " search - A standalone search indexer and solr instance"
- echo " rmi-hub - The RMI hub responsible for the internal "
- echo " communication between the ECE instances."
- echo " analysis - The Escenic Analysis Engine also knows as 'Stats'"
- echo ""
- echo " -i --instance "
- echo " The type instance, such as editor1, web1 or search1"
- echo ""
- echo " -p --publication "
- echo " Needed only for updating publication resources"
- echo ""
- echo " -r --resource "
- echo " Used for updating publication resources."
- echo " Must be one of: content-type, feature, layout, layout-group"
- echo " image-version, menu"
- echo ""
- echo " -v --verbose"
- echo " Prints out debug statements, useful for debugging."
- echo ""
- echo "The following commands are available:"
- echo " applog the type's app server log"
- echo " assemble runs the Assembly Tool *)"
- echo " clean removes temporary files created by $0 *)"
- echo " deploy deploys the assembled EAR *)"
- echo " help prints this help screen"
- echo " kill uses force to stop the type"
- echo " log the type's Log4J log"
- echo " outlog the $id script log (system out log)"
- echo " restart restarts the type"
- echo " start starts the type"
- echo " status checks if the type is running"
- echo " stop stops the type"
- echo " threaddump write a thread dump to standard out (system out log)"
- echo " update update publication resources"
- echo " versions lists the ECE component versions"
- echo ""
- echo "*) only applicable if type is 'engine'"
-}
-
for el in $command; do
case "$el" in
start)
start_type
;;
status)
- get_status
+ print "$(get_status)"
;;
stop)
stop_type
@@ -1078,9 +819,21 @@ for el in $command; do
restart)
restart_type
;;
+ info)
+ get_info_for_type
+ ;;
log)
tail_messages_log
;;
+ list-logs)
+ show_all_log_paths
+ ;;
+ list-publications)
+ show_all_publications
+ ;;
+ list-deployments)
+ show_all_deployments
+ ;;
outlog)
tail_out_log
;;
@@ -1096,29 +849,50 @@ for el in $command; do
deploy)
deploy
;;
+ repackage)
+ repackage "${file}"
+ ;;
assemble)
assemble
;;
+ package)
+ create_packages
+ ;;
clean)
clean_up
;;
versions)
list_versions
;;
+ list-instances)
+ print $(get_instance_list)
+ ;;
+ remove-old-log-files)
+ remove_old_log_files
+ ;;
update)
update_publication_resources
;;
+ edit)
+ update_publication_resources "edit_first"
+ ;;
+ create)
+ update_publication_resources "create_first"
+ ;;
+ backup)
+ backup_type
+ ;;
+ flush)
+ flush_caches
+ ;;
+ top)
+ run_ece_top
+ ;;
help)
- if [ -x $(which less) ]; then
- print_help | less
- elif [ -x $(which more) ]; then
- print_help | more
- else
- print_help
- fi
-
+ print_help
;;
*)
+ lookup_and_execute_dynamic_command_if_found "${el}" "$@"
print "Invalid command: '$el' :-("
print "Try 'ece help' to get a list of all commands available."
exit 1
@@ -1126,4 +900,3 @@ for el in $command; do
done
exit 0
-
diff --git a/usr/bin/ece-import b/usr/bin/ece-import
new file mode 100755
index 00000000..e32e930b
--- /dev/null
+++ b/usr/bin/ece-import
@@ -0,0 +1,418 @@
+#! /usr/bin/env bash
+
+## Runs one VOSA import job one time. The output is XML suitable for
+## the standard Escenic Syndication XML import job.
+##
+## The script can also create an import job from an import job archive
+##
+## See /usr/share/doc/vizrt/vosa-handbook/import-jobs.org for more
+## details on the structures this command operates on.
+
+function bootstrap_thyself() {
+ # first, try to be nice, then check the standard location
+ local dir=$(dirname $0)/../share/escenic/ece-scripts
+ if [ ! -d $dir ]; then
+ dir=/usr/share/escenic/ece-scripts
+ fi
+
+ local common_libraries="
+ common-bashing.sh
+ common-ece.sh
+ common-io.sh
+ common-os.sh
+ "
+
+ for el in $common_libraries; do
+ source $dir/$el 2>/dev/null || {
+ echo "$(basename $0): Could not load the library $el," \
+ "and I can't live without it :-(" | fmt
+ exit 1
+ }
+ done
+
+ for el in $dir/$(basename $0).d/*.sh; do
+ source $el 2>/dev/null || {
+ echo "$(basename $0): Could not load the library $el," \
+ "and I can't live without it :-(" | fmt
+ exit 1
+ }
+ done
+}
+
+bootstrap_thyself
+
+# internal variables
+escenic_group=escenic
+escenic_spool_base_dir=/var/spool/escenic/import
+escenic_user=escenic
+job_name=""
+log_base_dir=/var/log/escenic
+ece_scripts_version="straight-from-github"
+
+log=$log_base_dir/$(basename $0).log
+nursery_base_dir=/etc/escenic/engine/common
+publication_name=""
+raw_spool_base_dir=/var/spool/escenic/raw
+raw_state_base_dir=/var/lib/escenic/raw
+raw_transformation_base_dir=/var/cache/escenic/import
+raw_transformed_base_dir=/var/backups/escenic/import
+transformers_base_dir=/usr/share/escenic/import
+arg_regex_of_file="^(.*)$"
+arg_write_url=""
+
+# available commands/operations for ece-import
+COMMAND_IMPORT=1
+COMMAND_CREATE_IMPORT_CONFIGURATION=2
+COMMAND_DOWNLOAD_RAW_DATA=3
+command=$COMMAND_IMPORT
+
+function get_user_input() {
+ local next_is_name=0
+ local next_is_publication=0
+ local next_is_import_archive=0
+ local next_is_nursery_base_dir=0
+ local next_is_escenic_user=0
+ local next_is_escenic_group=0
+ local next_is_user=0
+ local next_is_password=0
+ local next_is_uri=0
+ local next_is_http_proxy=0
+ local next_is_regex_of_file=0
+ local next_is_write_url=0
+
+ for el in $@; do
+ if [[ "$el" == "-n" || "$el" == "--name" ]]; then
+ next_is_name=1
+ elif [[ "$el" == "-p" || "$el" == "--publication" ]]; then
+ next_is_publication=1
+ elif [[ "$el" == "-f" || "$el" == "--import-archive" ]]; then
+ next_is_import_archive=1
+ elif [[ "$el" == "--escenic-user" ]]; then
+ next_is_escenic_user=1
+ elif [[ "$el" == "--escenic-group" ]]; then
+ next_is_escenic_group=1
+ elif [[ "$el" == "--nursery-base-dir" ]]; then
+ next_is_nursery_base_dir=1
+ elif [[ "$el" == "--user" ]]; then
+ next_is_user=1
+ elif [[ "$el" == "--password" ]]; then
+ next_is_password=1
+ elif [[ "$el" == "--uri" ]]; then
+ next_is_uri=1
+ elif [[ "$el" == "--regex-of-file" ]]; then
+ next_is_regex=1
+ elif [[ "$el" == "--write_url" ]]; then
+ next_is_write_url=1
+ elif [[ "$el" == "--directories-only" ]]; then
+ directories_only=1
+ elif [[ "$el" == "--http-proxy" ]]; then
+ next_is_http_proxy=1
+ elif [ "$el" == "--version" -o "$el" == "-V" ]; then
+ echo "Version:" $ece_scripts_version
+ exit 0
+ elif [ $next_is_name -eq 1 ]; then
+ job_name=$el
+ next_is_name=0
+ elif [ $next_is_publication -eq 1 ]; then
+ publication_name=$el
+ next_is_publication=0
+ elif [ $next_is_import_archive -eq 1 ]; then
+ import_archive=$el
+ next_is_import_archive=0
+ elif [ $next_is_nursery_base_dir -eq 1 ]; then
+ nursery_base_dir=$el
+ next_is_nursery_base_dir=0
+ elif [ $next_is_escenic_user -eq 1 ]; then
+ escenic_user=$el
+ next_is_escenic_user=0
+ elif [ $next_is_escenic_group -eq 1 ]; then
+ escenic_group=$el
+ next_is_escenic_group=0
+ elif [ $next_is_user -eq 1 ]; then
+ user=$el
+ next_is_user=0
+ elif [ $next_is_password -eq 1 ]; then
+ password=$el
+ next_is_password=0
+ elif [ $next_is_uri -eq 1 ]; then
+ uri=$el
+ next_is_uri=0
+ elif [ $next_is_regex_of_file -eq 1 ]; then
+ arg_regex_of_file=$el
+ next_is_regex_of_file=0
+ elif [ $next_is_write_url -eq 1 ]; then
+ arg_write_url=$el
+ next_is_write_url=0
+ elif [ $next_is_http_proxy -eq 1 ]; then
+ the_http_proxy="$el"
+ next_is_http_proxy=0
+ else
+ if [[ "$el" == "create" ]]; then
+ command=$COMMAND_CREATE_IMPORT_CONFIGURATION
+ elif [[ "$el" == "download-import-data" ]]; then
+ command=$COMMAND_DOWNLOAD_RAW_DATA
+ fi
+ fi
+ done
+
+ local errors=0
+ if [ -z "$job_name" -a -z "${import_archive}" ]; then
+ print_and_log "You must specify which import job to run"
+ print_and_log "E.g.: $(basename $0) --name video"
+ errors=1
+ fi
+ if [ -z "$publication_name" -a -z "${import_archive}" ]; then
+ print_and_log "You must specify the publication name"
+ print_and_log "E.g.: $(basename $0) --publication mypub"
+ errors=1
+ fi
+
+ if [ -n "${import_archive}" -a ! -r "${import_archive}" ]; then
+ print_and_log "You have specified an import job archive file" \
+ "but it doesn't exist :-("
+ errors=1
+ fi
+
+ if [ $command -eq $COMMAND_DOWNLOAD_RAW_DATA ]; then
+ if [ -z "$user" ]; then
+ print_and_log "You must specify the the user"
+ print_and_log "E.g.: $(basename $0) --user lisa"
+ errors=1
+ fi
+ if [ -z "$password" ]; then
+ print_and_log "You must specify the the user"
+ print_and_log "E.g.: $(basename $0) --password foo"
+ errors=1
+ fi
+ if [ -z "$uri" ]; then
+ print_and_log "You must specify the the URI"
+ print_and_log "E.g.: $(basename $0) --uri http://feeds.com/myfeed"
+ errors=1
+ fi
+ fi
+
+ if [ $errors -eq 1 ]; then
+ remove_pid_and_exit_in_error
+ fi
+}
+
+## $1 :: the transformer (file name, relative or absoulte)
+function is_transformer_supported() {
+ if [ -z $1 ]; then
+ return
+ fi
+
+ local supported_transformer_list="pl py sh xsl"
+ for el in $supported_transformer_list; do
+ if [[ "$1" == *"${el}" ]]; then
+ echo 1
+ return
+ fi
+ done
+
+ echo 0
+}
+
+## $1 :: file
+function perform_transformations() {
+ for el in $transformers_base_dir/$publication_name/$job_name/transformers/[0-9]*; do
+ if [ $(is_transformer_supported $el) -eq 0 ]; then
+ log "$(yellow WARNING) The transformer $el isn't supported by $(basename $0)"
+ continue
+ fi
+
+ log "Applying transformation $(basename $el) to $1"
+
+ if [[ "$el" == *".sh" ]]; then
+ bash $el $1 >> $log 2>> $log
+
+ if [ $? -gt 0 ]; then
+ handle_transformation_error $el $1
+ return
+ fi
+ elif [[ "$el" == *".xsl" ]]; then
+ xsltproc --output ${1}.tmp ${el} ${1} >> $log 2>> $log
+
+ if [ $? -gt 0 ]; then
+ handle_transformation_error $el $1
+ return
+ else
+ run mv ${1}.tmp ${1}
+ fi
+ elif [[ "$el" == *".pl" ]]; then
+ perl $el $1 >> $log 2>> $log
+ if [ $? -gt 0 ]; then
+ handle_transformation_error $el $1
+ return
+ fi
+ elif [[ "$el" == *".py" ]]; then
+ python $el $1 >> $log 2>> $log
+ if [ $? -gt 0 ]; then
+ handle_transformation_error $el $1
+ return
+ fi
+ fi
+ transformation_count=$(( transformation_count + 1 ))
+ done
+}
+
+## Will log the transformer error and move it to the error archive.
+##
+## $1 :: transformer
+## $2 :: the raw/input file
+function handle_transformation_error() {
+ local dir=$raw_transformed_base_dir/$publication_name/$job_name/failed
+ log "$(red FAILED) The transformation $1 on file $2" \
+ "moving $2 to $dir and skipping to the next XML file"
+ run mv $2 $dir
+}
+
+import_error_count=0
+
+## $1 :: the directory to check for multimedia files.
+## $2 :: the directory to move any of these multimedia files to
+function move_any_multimedia_files_if_present() {
+ if [ ! -d $1 -o ! -d $2 ]; then
+ return
+ fi
+
+ local multimedia_file_count=$(
+ ls $1 | egrep -i ".(png|gif|jpg|jpeg|pdf)$" | wc -l
+ )
+ if [ $multimedia_file_count -gt 0 ]; then
+ log "Moving ${multimedia_file_count} multimedia files from $1 to $2"
+ mv $1/*.{png,gif,jpg,jpeg,pdf} $2 >> $log 2>/dev/null
+ fi
+}
+
+function import_raw_files() {
+ raw_file_count=0
+ for f in $(find $raw_spool_base_dir/$publication_name/$job_name -type f); do
+ raw_file_count=$(( raw_file_count + 1 ))
+ transformation_count=0
+ print_and_log "Importing raw XML #${raw_file_count}: $(basename $f) ..."
+ local file=$raw_transformation_base_dir/$publication_name/$job_name/$(basename $f)
+ run cp $f $file
+ perform_transformations $file
+
+ log "Applied $transformation_count transformations to $file"
+ if [ $(is_escenic_xml_ok $file) -eq 1 ]; then
+ local dir=$escenic_spool_base_dir/$publication_name/$job_name/new
+ log "Transformed XML is OK, moving transformed file to" $dir
+ move_any_multimedia_files_if_present $(dirname $file) $dir
+ run mv $file $dir
+ dir=$raw_transformed_base_dir/$publication_name/$job_name/succeeded
+ log "Transformed XML is OK, moving original raw XML to" $dir \
+ "and gzip-ing it."
+ run mv $f $dir
+ run gzip --force $dir/$(basename $f)
+ else
+ local dir=$raw_transformed_base_dir/$publication_name/$job_name/failed
+ log $(red ERROR) "Transformed XML #${raw_file_count}," \
+ $file "isn't valid Escenic Syndication XML, so moving it to" $dir
+ run mv $f $dir
+ import_error_count=$(( import_error_count + 1 ))
+ fi
+ done
+}
+
+function verify_import_job_configuration() {
+ verify_writable_dir_list \
+ $raw_spool_base_dir/$publication_name/$job_name \
+ $raw_state_base_dir/$publication_name/$job_name \
+ $raw_transformation_base_dir/$publication_name/$job_name \
+ $raw_transformed_base_dir/$publication_name/$job_name \
+ $escenic_spool_base_dir/$publication_name/$job_name/new \
+ $escenic_spool_base_dir/$publication_name/$job_name/archive \
+ $escenic_spool_base_dir/$publication_name/$job_name/error
+ verify_readable_dir_list $transformers_base_dir/$publication_name/$job_name
+
+ local dir=$transformers_base_dir/$publication_name/$job_name/transformers
+ local tranformation_count=$(
+ ls $dir | \
+ grep ^[0-9] | \
+ egrep ".sh$|.pl$|.py$|.xsl$" | \
+ wc -l
+ )
+
+ if [ $command -eq $COMMAND_IMPORT -a $tranformation_count -lt 1 ]; then
+ print_and_log "$(yellow WARNING) No transformers found in" \
+ "$dir/, I'm assuming the incoming" \
+ "data is already tranformed into Escenic Syndication XML"
+ fi
+
+ print_and_log "Running import" $job_name \
+ "for publication" $publication_name
+}
+
+function print_report() {
+ if [ $command -eq $COMMAND_IMPORT ]; then
+ print_and_log "Number of raw XML files processed:" $raw_file_count
+ print_and_log "Number of raw XML successes:" \
+ $(green $(( raw_file_count - import_error_count )))
+ print_and_log "Number of raw XML errors:" $(red $import_error_count)
+ fi
+}
+
+assert_commands_available xsltproc xmllint xml_grep
+get_user_input $@
+
+function run_import() {
+ pid_file=${pid_file/%.pid/-run-import.pid}
+ lock_file=${lock_file/%.lock/-run-import.lock}
+ common_pre_run
+
+ verify_import_job_configuration
+ import_raw_files
+ common_post_run
+}
+
+function run_create_import_configuration() {
+ pid_file=${pid_file/%.pid/-create.pid}
+ lock_file=${lock_file/%.lock/-create.lock}
+ common_pre_run
+
+ if [ -z $import_archive ]; then
+ if [ ${directories_only-0} -eq 0 ]; then
+ create_import_configuration $publication_name $job_name
+ fi
+ create_import_directories $publication_name $job_name
+ else
+ apply_import_archive
+ fi
+
+ common_post_run
+}
+
+function run_download_raw_data() {
+ pid_file=${pid_file/%.pid/-download.pid}
+ lock_file=${lock_file/%.lock/-download.lock}
+
+ common_pre_run
+ verify_import_job_configuration
+ download_latest_files
+ common_post_run
+}
+
+function common_pre_run() {
+ print_and_log "Started @ $(date), I'm logging to $log"
+ create_pid
+ create_lock_or_fail
+}
+
+function common_post_run() {
+ print_manual_steps
+ print_report
+
+ print_and_log "Finished @ $(date), enjoy thyself!"
+ remove_pid
+ remove_lock
+}
+
+if [[ "$command" == $COMMAND_IMPORT ]]; then
+ run_import
+elif [[ "$command" == $COMMAND_CREATE_IMPORT_CONFIGURATION ]]; then
+ run_create_import_configuration
+elif [[ "$command" == $COMMAND_DOWNLOAD_RAW_DATA ]]; then
+ run_download_raw_data
+fi
diff --git a/usr/bin/generate-changelog b/usr/bin/generate-changelog
new file mode 100755
index 00000000..99fc980e
--- /dev/null
+++ b/usr/bin/generate-changelog
@@ -0,0 +1,207 @@
+#! /usr/bin/env bash
+
+log=$HOME/.$(basename $0).log
+archive_base_dir=$HOME/.$(basename $0)
+
+function bootstrap_thyself() {
+ # first, try to be nice, then check the standard location
+ local dir=$(dirname $0)/../share/escenic/ece-scripts
+ if [ ! -d $dir ]; then
+ dir=/usr/share/escenic/ece-scripts
+ fi
+
+ local common_libraries="
+ common-bashing.sh
+ common-io.sh
+ "
+
+ for el in $common_libraries; do
+ source $dir/$el 2>/dev/null || {
+ echo "$(basename $0): Could not load the library $el," \
+ "and I can't live without it :-(" | fmt
+ exit 1
+ }
+ done
+}
+
+function read_user_settings() {
+ local file=$HOME/.$(basename $0).conf
+ if [ -r $file ]; then
+ run source $file
+ else
+ log $(blue INFO) $file "doesn't exist, will default to Atlassian on Demand"
+ fi
+}
+
+function get_header_from_jira() {
+ local body=$(curl -u ${user}:${password} -s ${jira_base_url}/browse/${1})
+ echo "$body" | grep '' | sed -e 's///g' -e 's/<\/title>//g'
+}
+
+function get_to_revision() {
+ echo ${to-COMMITTED}
+}
+
+function get_from_revision() {
+ echo ${from-PREV}
+}
+
+function get_user_input() {
+ local next_is_from=0
+ local next_is_to=0
+ local next_is_project=0
+ local next_is_user=0
+ local next_is_password=0
+
+ for el in "$@"; do
+ if [[ "$el" == "-s" || "$el" == "--from" ]]; then
+ next_is_from=1
+ elif [[ "$el" == "-u" || "$el" == "--user" ]]; then
+ next_is_user=1
+ elif [[ "$el" == "-p" || "$el" == "--password" ]]; then
+ next_is_password=1
+ elif [[ "$el" == "-t" || "$el" == "--to" ]]; then
+ next_is_to=1
+ elif [[ "$el" == "-p" || "$el" == "--project" ]]; then
+ next_is_project=1
+ elif [[ "$el" == "-f" || "$el" == "--full" ]]; then
+ full_listing=1
+ elif [ ${next_is_from-0} -eq 1 ]; then
+ from=$el
+ next_is_from=0
+ elif [ ${next_is_user-0} -eq 1 ]; then
+ user=$el
+ next_is_user=0
+ elif [ ${next_is_password-0} -eq 1 ]; then
+ password=$el
+ next_is_password=0
+ elif [ ${next_is_to-0} -eq 1 ]; then
+ to=$el
+ next_is_to=0
+ elif [ ${next_is_project-0} -eq 1 ]; then
+ project_code=$el
+ next_is_project=0
+ fi
+ done
+}
+
+function should_regenerate() {
+ if [[ $(is_number $(get_from_revision)) -eq 1 && \
+ $(is_number $(get_to_revision)) ]]; then
+ echo 0
+ return
+ fi
+
+ echo 1
+}
+
+function get_commit_information_from_vcs() {
+ the_diff=$(get_archive_dir)/from-$(get_from_revision)-to-$(get_to_revision).diff
+
+ if [[ ! -e $the_diff || $(should_regenerate) -eq 1 ]]; then
+ svn diff -r $(get_from_revision):$(get_to_revision) > $the_diff
+ exit_on_error "svn diff -r $(get_from_revision):$(get_to_revision)"
+ fi
+
+ if [ ${full_listing-0} -eq 1 ]; then
+ cat $the_diff
+ else
+ echo "Full diff of all" $(egrep '^(\+|\-)' $the_diff | wc -l) \
+ "changes:" $the_diff | fmt
+ fi
+}
+
+## $@ :: svn revision number or tag name
+function get_date_from_svn_log() {
+ echo $(svn log -r "$@" | sed -n '2p' | cut -d'|' -f3)
+}
+
+function get_svn_location() {
+ svn info | grep URL | cut -d':' -f2-
+}
+
+function get_info_from_jira() {
+ the_report=$(get_archive_dir)/from-$(get_from_revision)-to-$(get_to_revision).report
+
+ if [[ ! -e $the_report || $(should_regenerate) -eq 1 ]]; then
+ echo "Changes in $(get_svn_location)" > $the_report
+ echo "From: revision $(get_from_revision) @" \
+ $(get_date_from_svn_log $(get_from_revision)) >> $the_report
+ echo "To : revision $(get_to_revision) @" \
+ $(get_date_from_svn_log $(get_to_revision)) >> $the_report
+
+ local commit_log=$(svn log -r $(get_from_revision):$(get_to_revision))
+ echo "$commit_log" | \
+ grep ${project_code}-[0-9]* | \
+ sed "s#.*\(${project_code}-[0-9]*\).*#\1#g" | \
+ sort | \
+ uniq | while read f; do
+ echo " *" $(get_header_from_jira $f) | fmt >> $the_report
+ echo " URL: ${jira_base_url}/browse/$(basename $f)" >> $the_report
+ echo "" >> $the_report
+ done
+
+ add_risk_assemsment_to_report
+ fi
+
+ echo "Report:" $the_report
+}
+
+function sanity_check() {
+ if [ ! -e $(pwd)/.svn ]; then
+ print "This directory, $(pwd), " \
+ "does not contain a working version control checkout."
+ exit 1
+ fi
+
+ # defaulting to Atlassian on demand
+ jira_base_url=${jira_base_url-https://vizrtcustomers.jira.com}
+ if [ -z "$svn_base_url" ]; then
+ # bash default string substitution terminates with slashes, hence
+ # have to set this manually here.
+ svn_base_url=${jira_base_url}/svn
+ fi
+
+ conf_file=$HOME/.$(basename $0).conf
+ ensure_variable_is_set \
+ project_code \
+ user \
+ password \
+ jira_base_url \
+ svn_base_url
+
+ if [[ "$(get_from_revision)" == "$(get_to_revision)" ]]; then
+ print_and_log "From and to revision are the same," \
+ "will no create any change log"
+ exit 0
+ fi
+}
+
+function get_project() {
+ echo $(lowercase ${project_code})
+}
+
+function get_archive_dir() {
+ local project_context=$(lowercase $(get_svn_location | \
+ sed -e "s#${svn_base_url}/##g" -e 's#[ ]*##g')
+ )
+
+ local dir=${archive_base_dir}/${project_context}
+ make_dir $dir
+ echo $dir
+}
+
+function add_risk_assemsment_to_report() {
+ echo "Risk assessment score: " \
+ $(wc -l $the_diff 2>/dev/null | cut -d' ' -f1) \
+ >> $the_report
+}
+
+bootstrap_thyself
+read_user_settings
+get_user_input "$@"
+sanity_check
+get_commit_information_from_vcs
+get_info_from_jira
+
+
diff --git a/usr/bin/generate-git-changelog b/usr/bin/generate-git-changelog
new file mode 100755
index 00000000..48dabf38
--- /dev/null
+++ b/usr/bin/generate-git-changelog
@@ -0,0 +1,194 @@
+#! /usr/bin/env bash
+
+log=$HOME/.$(basename $0).log
+archive_base_dir=$HOME/.$(basename $0)
+
+function bootstrap_thyself() {
+ # first, try to be nice, then check the standard location
+ local dir=$(dirname $0)/../share/escenic/ece-scripts
+ if [ ! -d $dir ]; then
+ dir=/usr/share/escenic/ece-scripts
+ fi
+
+ local common_libraries="
+ common-bashing.sh
+ common-io.sh
+ "
+
+ for el in $common_libraries; do
+ source $dir/$el 2>/dev/null || {
+ echo "$(basename $0): Could not load the library $el," \
+ "and I can't live without it :-(" | fmt
+ exit 1
+ }
+ done
+}
+
+function get_header_from_jira() {
+ local body=$(curl -u ${user}:${password} -s ${jira_base_url}/browse/${1})
+ echo "$body" | grep '' | sed -e 's///g' -e 's/<\/title>//g'
+}
+
+# --to revision number
+function get_to_revision() {
+ echo ${to-COMMITTED}
+}
+
+# --from revision number
+function get_from_revision() {
+ echo ${from-PREV}
+}
+
+function get_user_input() {
+ local next_is_from=0
+ local next_is_to=0
+ local next_is_project=0
+ local next_is_user=0
+ local next_is_password=0
+ local next_is_jirabaseurl=0
+
+ for el in "$@"; do
+ if [[ "$el" == "-s" || "$el" == "--from" ]]; then
+ next_is_from=1
+ elif [[ "$el" == "-u" || "$el" == "--user" ]]; then
+ next_is_user=1
+ elif [[ "$el" == "-p" || "$el" == "--password" ]]; then
+ next_is_password=1
+ elif [[ "$el" == "-t" || "$el" == "--to" ]]; then
+ next_is_to=1
+ elif [[ "$el" == "-p" || "$el" == "--project" ]]; then
+ next_is_project=1
+ elif [[ "$el" == "-j" || "$el" == "--jirabaseurl" ]]; then
+ next_is_jirabaseurl=1
+ elif [[ "$el" == "-f" || "$el" == "--full" ]]; then
+ full_listing=1
+ elif [ ${next_is_from-0} -eq 1 ]; then
+ from=$el
+ next_is_from=0
+ elif [ ${next_is_user-0} -eq 1 ]; then
+ user=$el
+ next_is_user=0
+ elif [ ${next_is_password-0} -eq 1 ]; then
+ password=$el
+ next_is_password=0
+ elif [ ${next_is_to-0} -eq 1 ]; then
+ to=$el
+ next_is_to=0
+ elif [ ${next_is_project-0} -eq 1 ]; then
+ project_code=$el
+ next_is_project=0
+ elif [ ${next_is_jirabaseurl-0} -eq 1 ]; then
+ jirabaseurl=$el
+ next_is_jirabaseurl=0
+ fi
+ done
+}
+
+
+function get_commit_information_from_vcs() {
+ the_diff=$(get_archive_dir)/from-$(get_from_revision)-to-$(get_to_revision).diff
+
+ if [[ ! -e $the_diff ]]; then
+ git diff $(get_from_revision) $(get_to_revision) > $the_diff
+ exit_on_error "git diff $(get_from_revision) $(get_to_revision)"
+ fi
+
+ if [ ${full_listing-0} -eq 1 ]; then
+ cat $the_diff
+ else
+ echo "Full diff of all" $(egrep '^(\+|\-)' $the_diff | wc -l) \
+ "changes:" $the_diff | fmt
+ fi
+
+ if [[ ! -z $jirabaseurl ]]; then
+ get_info_from_jira
+ fi
+
+}
+
+## $@ :: git last revision date
+#Fri Sep 27 11:18:05 2013 +0600
+function get_date_from_git_log() {
+ echo $(git log -1 --format="%cd")
+}
+
+# e.g. ssh://git@git.vizrtsaas.com/ccipoc
+function get_git_location() {
+ echo $(git config --get remote.origin.url)
+}
+
+
+function get_info_from_jira() {
+ the_report=$(get_archive_dir)/from-$(get_from_revision)-to-$(get_to_revision).report
+
+ if [[ ! -e $the_report ]]; then
+ echo "Changes in branch:$(get_project_branch) and location:$(get_git_location) " > $the_report
+ echo "From: revision $(get_from_revision) @" \
+ $(get_date_from_git_log $(get_from_revision)) >> $the_report
+ echo "To : revision $(get_to_revision) @" \
+ $(get_date_from_git_log $(get_to_revision)) >> $the_report
+
+ local commit_log=$(git log $(get_from_revision)..$(get_to_revision))
+ echo "$commit_log" | \
+ grep $(get_jira_project_name)-[0-9]* | \
+ sed "s#.*\($(get_jira_project_name)-[0-9]*\).*#\1#g" | \
+ sort | \
+ uniq | while read f; do
+ echo " *" $(get_header_from_jira $f) | fmt >> $the_report
+ echo " URL: ${jira_base_url}/browse/$(basename $f)" >> $the_report
+ echo "" >> $the_report
+ done
+
+ add_risk_assemsment_to_report
+ fi
+
+ echo "Report:" $the_report
+}
+
+function sanity_check() {
+ #if [ ! -e $(pwd)/src/.git ]; then
+ # print "This directory, $(pwd), " \
+ # "does not contain a working version control checkout."
+ #exit 1
+ #fi
+
+ # defaulting to Atlassian on demand
+ jira_base_url=${jirabaseurl}
+
+ if [[ "$(get_from_revision)" == "$(get_to_revision)" ]]; then
+ print_and_log "From and to revision are the same," \
+ "will no create any change log"
+ exit 0
+ fi
+}
+
+#e.g. ccipoc.git
+function get_project_name() {
+ echo ${project_code} | awk '{split($0,array,"/")} END{print array[1]}'
+}
+
+function get_jira_project_name() {
+ echo ${project_code} | awk '{split($0,array,"/")} END{print array[1]}' | sed 's/.git//g' | tr [a-z] [A-Z]
+
+}
+
+function get_project_branch() {
+ echo ${project_code} | awk '{split($0,array,"/")} END{print array[2]}'
+}
+
+function get_archive_dir() {
+ local directory=${archive_base_dir}/$(get_project_name)/$(get_project_branch)
+ make_dir $directory
+ echo $directory
+}
+
+function add_risk_assemsment_to_report() {
+ echo "Risk assessment score: " \
+ $(wc -l $the_diff 2>/dev/null | cut -d' ' -f1) \
+ >> $the_report
+}
+
+bootstrap_thyself
+get_user_input "$@"
+sanity_check
+get_commit_information_from_vcs
diff --git a/usr/bin/sync-network-drive b/usr/bin/sync-network-drive
new file mode 100755
index 00000000..6cec78cf
--- /dev/null
+++ b/usr/bin/sync-network-drive
@@ -0,0 +1,198 @@
+#! /usr/bin/env bash
+
+# Script made for syncing the NFS exports between the serving
+# hosts. The script ensures that there is only one instance of it
+# running and thus that two simultaneous runs it will not cause
+# corruption of data.
+#
+#
+# Example usage with source (-s) and target (-t):
+#
+# $ sync-network-drive \
+# -s remote-server:/var/lib \
+# -t /var/backups/remote-server
+#
+# The full path on the remote server is replicated locally here, so
+# after this command, you'll have remote-server's /var/lib directory
+# under your local directory /var/backups/remote-server/var/lib And
+# one last thing: trailing slashes are not needed
+
+log=/var/log/escenic/$(basename $0).log
+
+function bootstrap_thyself() {
+ # first, try to be nice, then check the standard location
+ local dir=$(dirname $0)/../share/escenic/ece-scripts
+ if [ ! -d $dir ]; then
+ dir=/usr/share/escenic/ece-scripts
+ fi
+
+ for el in common-bashing.sh common-io.sh; do
+ source $dir/$el 2>/dev/null || {
+ echo "$(basename $0): Could not load the library $el," \
+ "and I can't live without it :-(" | fmt
+ exit 1
+ }
+ done
+}
+
+bootstrap_thyself
+
+tmp_known_hosts_file=$(mktemp)
+
+rsync_opts="
+--recursive
+--links
+--perms
+--group
+--owner
+--compress
+--itemize-changes
+--ignore-times
+--checksum
+--cvs-exclude
+"
+rsync_additional_outgoing_opts="
+--dry-run
+--verbose
+"
+# the backslashes need to be here
+rsync_ssh_opts="\
+-o BatchMode=yes \
+-o UserKnownHostsFile=${tmp_known_hosts_file} \
+-o StrictHostKeyChecking=no \
+-p 22 \
+"
+
+outgoing=0
+verbose=0
+
+function ensure_src_is_sane() {
+ # checking that the src is :
+ if [[ $(dirname $(echo "$src" | cut -d':' -f2 )) == /** ]]; then
+ return
+ else
+ print "Source $src is insane, should be :"
+ remove_lock
+ tidy_up
+ exit 1
+ fi
+}
+
+function ensure_target_dir_is_there() {
+ mkdir -p $target_dir || (echo "failed creating target dir"; exit 1 )
+
+ if [ ! -w $target_dir ]; then
+ print $USER "cannot write to $target_dir :-("
+ remove_lock
+ tidy_up
+ exit 1
+ fi
+}
+
+function sync_it() {
+ if [ $outgoing -eq 1 ]; then
+ rsync_opts=${rsync_opts}" "${rsync_additional_outgoing_opts}
+ fi
+
+ if [ $verbose -eq 1 ]; then
+ rsync_opts=${rsync_opts}" --verbose "
+ fi
+
+ print "Sync on $HOSTNAME started @ $(stat -c %y $lock_file)" \
+ "${src} -> ${target_dir}"
+ run rsync $rsync_opts \
+ -e "ssh $rsync_ssh_opts" \
+ $src/ \
+ $target_dir/
+}
+
+function tidy_up() {
+ run rm $tmp_known_hosts_file
+}
+
+function print_report() {
+ local now=$(date +%s)
+ local started=$(stat -c %Y $lock_file)
+ local seconds=$(( now - started ))
+ local days=$(( seconds / ( 60 * 60 * 24 ) ))
+ local seconds_left=$(( seconds - ( $days * 60 * 60 * 24 ) ))
+ local hours=$(( seconds_left / ( 60 * 60 ) ))
+ local seconds_left=$(( seconds_left - ( $hours * 60 * 60 ) ))
+ local minutes=$(( seconds_left / 60 ))
+ local seconds_left=$(( seconds_left - $minutes * 60 ))
+
+ print "Hi! $src has now been synced to $target_dir"
+ print "It took" ${days}d ${hours}h ${minutes}m ${seconds_left}s
+
+}
+
+function get_user_options() {
+ while getopts ":s:t:ov" opt; do
+ case $opt in
+ s)
+ src=${OPTARG}
+ ;;
+ t)
+ target_dir_root=${OPTARG}
+
+ if [[ $target_dir_root == "/" ]]; then
+ target_dir_root=""
+ fi
+
+ target_dir=${target_dir_root}$(echo $src | cut -d":" -f2)
+ ;;
+ o)
+ outgoing=1
+ ;;
+ v)
+ verbose=1
+ ;;
+ \?)
+ print "Invalid option: -$OPTARG" >&2
+ exit 1
+ ;;
+ :)
+ print "Option -$OPTARG requires an argument." >&2
+ exit 1
+ ;;
+ *)
+ print "Command is $OPTARG"
+ exit 0
+ esac
+ done
+}
+
+function ensure_user_options_are_ok() {
+ if [ -z "${src}" ]; then
+ cat <:, e.g.:
+$(basename $0) -s app1:/var/log -t /var/backups/app1
+EOF
+
+tidy_up
+exit 1
+ fi
+
+ if [ -z "${target_dir}" ]; then
+ cat <, e.g.:
+$(basename $0) -s app1:/var/log -t /var/backups/app1
+EOF
+
+tidy_up
+exit 1
+ fi
+
+}
+
+get_user_options $@
+ensure_user_options_are_ok
+create_pid
+create_lock
+ensure_src_is_sane
+ensure_target_dir_is_there
+sync_it
+print_report
+remove_lock
+tidy_up
+remove_pid
diff --git a/usr/bin/system-info b/usr/bin/system-info
index 3df03f28..bc1297c0 100755
--- a/usr/bin/system-info
+++ b/usr/bin/system-info
@@ -1,193 +1,394 @@
#! /usr/bin/env bash
-# Getting system info, especially useful before reporting to Escenic
-# select Support.
-
-# can be: ascii, confluence
-output_format=ascii
-on_debian_or_derivate=0
-on_gentoo_or_derivate=0
-on_redhat_or_derivate=0
-on_linux=0
-
-important_packages_on_debian="
-ant
-apache2
-libapr1
-libmysql-java
-libtcnative-1
-maven2
-mysql-server
-nginx
-percona-server-server
-slapd
-sun-java6-jdk
-sun-java6-jre
-tomcat6
-tomcat6-user
-varnish
-"
-important_packages_on_gentoo="
-dev-db/percona-server
-dev-java/ant-contrib
-dev-java/ant-nodeps
-dev-java/maven-bin
-dev-libs/apr
-net-misc/memcached
-net-nds/openldap
-virtual/jre-1.6.0
-www-servers/apache
-www-servers/nginx
-www-servers/varnish
-"
-
-if [ `uname -s` = "Linux" ]; then
- on_linux=1
-fi
-
-if [ -x /usr/bin/dpkg -a -e /etc/debian_version ]; then
- on_debian_or_derivate=1
-elif [ -x /usr/bin/emerge -a -e /etc/gentoo-release ]; then
- on_gentoo_or_derivate=1
-fi
-
-
-function print_ruler()
-{
- if [ $output_format = "ascii" ]; then
- for i in {0..72}; do
- echo -n $1
- done
- fi
+## Script which creates an overview of system information related to
+## the specified ECE/EAE/Search instance, example invocation:
+##
+## $ system-info -i engine1 | xmllint --format - > /var/www/engine1.html
+##
+## Add this to /etc/cronttab if you want it to create an HTML report
+## every minute:
+##
+## echo '* * * * * root system-info -f html > /var/www/index.html' >> /etc/crontab
+
+ece_user=""
+ece_scripts_version="straight-from-github"
+
+## possible values: html, org, confluence, yaml, json (not complete)
+format=yaml
+generate_output_file_per_module=0
+output_dir=$(pwd)
+output_file=""
+
+current_indent_level=0
+INDENT=" "
+verbose=0
+temporaries=1
+log=$HOME/.$(basename $0).log
+
+function init() {
+ # first, try to be nice
+ ece_scripts_dir=$(dirname $0)/../share/escenic/ece-scripts
+
+ # then check the standard location
+ if [ ! -d $ece_scripts_dir ]; then
+ ece_scripts_dir=/usr/share/escenic/ece-scripts
+ fi
+
+ source $ece_scripts_dir/common-ece.sh
+ source $ece_scripts_dir/common-bashing.sh
+ source $ece_scripts_dir/common-io.sh
}
-function print_pre_start()
-{
- if [ $output_format = "confluence" ]; then
- echo "{code}"
+## Runs extra system-info modules
+function run_system_info_modules() {
+ if [ -d $ece_scripts_dir ]; then
+ # load system-info modules
+ if [ ! -d $ece_scripts_dir/system-info.d ]; then
+ return
fi
+
+ for el in $(\ls $ece_scripts_dir/system-info.d/*.sh 2>/dev/null); do
+ if [ $generate_output_file_per_module -eq 1 ]; then
+ source $el | tee ${output_dir}/$(basename $el).${format}
+ else
+ source $el
+ fi
+ done
+ fi
}
-function print_pre_end()
-{
- if [ $output_format = "confluence" ]; then
- echo "{code}"
- fi
+## $1 : indent level, optional, if not set, will use the
+## current_indent_level
+function get_indent() {
+ local result=""
+
+ if [[ "${1}x" != "x" ]]; then
+ local number_of_indents=$1
+ else
+ local number_of_indents=$current_indent_level
+ fi
+
+ for (( i = 0; i < $number_of_indents; i++ )); do
+ result="${INDENT}$result"
+ done
+
+ echo "$result"
}
-function print_header()
+function create_header() {
+ local title="Overview of $HOSTNAME"
+
+ if [ $format == "html" ]; then
+cat <
+
+ $title @ $(date)
+
+
+
+$(cat $ece_scripts_dir/vizrt-logo-svg.html)
+EOF
+ elif [ $format == "json" ]; then
+ cat </dev/null | grep ^ii | sed 's/ii\ \ //g'
- done
- elif [ $on_gentoo_or_derivate -eq 1 ]; then
- for el in $important_packages_on_gentoo; do
- equery --no-color --no-pipe list $el 2>/dev/null | \
- grep -v "Searching for" | \
- cut -d']' -f3- 2>/dev/null
- done
+function create_footer() {
+ if [ $format == "html" ]; then
+ cat <
+
+EOF
+
+ elif [ $format == "json" ]; then
+ cat <$el"
+ else
+ result="$result $el"
+ fi
+ done
+ else
+ result="$@"
+ fi
+
+ echo "$result"
}
-function list_os_info()
-{
- print_header "Kernel version"
- uname -a
-
- print_header "Distribution information"
- if [ $on_debian_or_derivate -eq 1 ]; then
- echo "Debian or derivate, version "`cat /etc/debian_version`
- elif [ -r /etc/gentoo-release ]; then
- cat /etc/gentoo-release
- fi
+function print_un_ordered_list_start() {
+ if [ $format == "org" ]; then
+ echo ""
+ elif [ $format == "html" ]; then
+ echo "
"
+ elif [ $format == "confluence" ]; then
+ echo ""
+ elif [ $format == "json" ]; then
+ echo " ["
+ fi
}
-function list_db_information()
-{
- print_header "Database details"
- if [ -x /usr/sbin/mysqld ]; then
- /usr/sbin/mysqld -V
- else
- mysql -V 2>/dev/null
- mysql5 -V 2>/dev/null
- fi
+function print_un_ordered_list_end() {
+ if [ $format == "org" ]; then
+ echo ""
+ elif [ $format == "html" ]; then
+ echo "
The ece script offers TAB completion, given that your version of BASH
-supports this and that you have enabled it (some distributions hasn't
-turned on BASH completion per default).
-
-
-
-
-
-
1.1 Completing ece commands
-
-
-
You will find yourself using this regularly, both for speed, but also
-to remember all the different options and their correct wording:
-
$ ece help
-Usage: /home/torstein/bin/ece [-t <type>] [-i <instance>] <command>
-
-DESCRIPTION
- -t --type <type>
- The following types are available:
- engine - The Escenic Content Engine, this is the default
- and is the assumed type if none is specified.
- search - A standalone search indexer and solr instance
- rmi-hub - The RMI hub responsible for the internal
- communication between the ECE instances.
- analysis - The Escenic Analysis Engine also knows as 'Stats'
-
- -i --instance <instance>
- The type instance, such as editor1, web1 or search1
-
- -p --publication <publication>
- Needed only for updating publication resources
-
- -r --resource <resource>
- Used for updating publication resources.
- Must be one of: content-type, feature, layout, layout-group
- image-version, menu
-
- -v --verbose
- Prints out debug statements, useful for debugging.
-
-The following commands are available:
- applog the type's app server log
- assemble runs the Assembly Tool *)
- clean removes temporary files created by /home/torstein/bin/ece *)
- deploy deploys the assembled EAR *)
- help prints this help screen
- kill uses force to stop the type
- log the type's Log4J log
- outlog the [ece#engine] script log (system out log)
- restart restarts the type
- start starts the type
- status checks if the type is running
- stop stops the type
- threaddump write a thread dump to standard out (system out log)
- update update publication resources
- versions lists the ECE component versions
-
-*) only applicable if type is 'engine'
-
-