This document is intended as a reference for system administrators who manage the ePages installation on the UNIX level. The inaccurate usage of the functions and scripts as described below may damage the ePages system seriously. For any questions, first ask the ePages support department.

Starting/Stopping ePages

ePages services are started/stopped by the run script /etc/init.d/epages6.

ePages Java Services

Each ePages Java service has its own run script:

  1. /etc/init.d/epagesj

  2. /etc/init.d/epages-solr

  3. /etc/init.d/epages-solr-slave

Each of these services can be run with following arguments:


starts the service (does nothing if already started)


stops the service (does nothing if already stopped)


stops, then starts the service


shows the status of the service


/etc/init.d/epagesj restart
/etc/init.d/epagesj status

status has following return codes:


service is running


service is stopped but its pid file in /var/run/*.pid exists


service is stopped but its lock file in /var/lock/subsys/ exists


service is stopped, neither lock file nor pid file exists


status is unknown due to insufficient user privileges

At Boot Time

At boot time, /etc/init.d/epages6 starts all ePages services. If you don’t want ePages to start at boot time, run following command:

chkconfig --del epages6

After running this command, if you want ePages to start at boot time again, run following command:

chkconfig --add epages6

The same holds for the epages Java services mentioned above.

All ePages Services

/etc/init.d/epages6 starts/stops all ePages services existing on the machine where it is executed. If ePages services are distributed over various servers, each server only handles it’s own part of the services. Hence, if you want to start/stop all ePages services manually, run /etc/init.d/epages6 on all involved servers.

Running /etc/init.d/epages6 without parameters shows you the usage:

# /etc/init.d/epages6
Usage: EPAGES_IGNORE='[services]' /etc/init.d/epages6 ARGUMENT
Arguments (use one of them):
  start         : start database, web server and epages services
  stop          : stop database, web server and epages services
  show          : show all running epages processes
  start_httpd [arg] : start web server (httpd-epages) (with arg, one of:)
              close : close all outside connections
               open : open all outside connections
             reload : reload configuration
            graceful: graceful restart
  stop_httpd    : stop web server (httpd-epages)
  start_db      : start database server
  stop_db       : stop database server
  start_service : start epages application server (epagesService)
  stop_service  : stop epages application server (epagesService)
  restart_perl  : restart epages application server (perl)
  start_rr      : start epages request router (RequestRouter)
  stop_rr       : stop epages request router (RequestRouter)
  start_cron    : start epages cron jobs
  stop_cron     : stop epages cron jobs
  show_cron     : show all epages cron jobs
  perm {where}  : sets UNIX user/group/mode
       {where}  : admin stores webroot static apache perl cartridges mysql all
  EPAGES_IGNORE='[services]' : space separated list of services not to start/stop
                 [services]  : cron appsrv reqsrv dbsrv websrv

If you want to (re)start all ePages services, run:

/etc/init.d/epages6 start

If you want to (re)start all (but some) ePages services, run:

EPAGES_IGNORE='[services]' /etc/init.d/epages6 start

where [services] is a space-separated list of the services to ignore (use one or more of: cron appsrv reqsrv dbsrv websrv).

You may use as well EPAGES_IGNORE= for stopping all (but some) ePages services:

EPAGES_IGNORE='[services]' /etc/init.d/epages6 stop

Show all running ePages services:

/etc/init.d/epages6 show

ePages Cron Jobs

(Re)start the ePages cronjobs (ignoring other ePages services) by:

/etc/init.d/epages6 start_cron

Stop the ePages cronjobs (ignoring other ePages services) by:

/etc/init.d/epages6 stop_cron

Show all installed ePages cronjobs by (see an example output with explanation in section

/etc/init.d/epages6 show_cron

ePages Database Server

(Re)start just the ePages database server (MySQL) (ignoring other ePages services) by:

/etc/init.d/epages6 start_db

Stop just the ePages database server (MySQL) (ignoring other ePages services) by:

/etc/init.d/epages6 stop_db

ePages Request Router

(Re)start just the ePages request router (ignoring other ePages services) by:

/etc/init.d/epages6 start_rr

Stop just the ePages request router (ignoring other ePages services) by:

/etc/init.d/epages6 stop_rr

ePages Application Server

(Re)start just the ePages application server (Perl) (ignoring other ePages services) by:

/etc/init.d/epages6 start_service

Stop just the ePages application server (Perl) (ignoring other ePages services) by:

/etc/init.d/epages6 stop_service

The following command restarts the ePages application server gracefully. This differs from a normal restart in that the Perl processes are not aborted, but finished and restarted.

/etc/init.d/epages6 restart_perl

ePages Web Server

(Re)start just the ePages web server (httpd) (ignoring other ePages services) by:

/etc/init.d/epages6 start_httpd

Stop just the ePages web server (httpd) (ignoring other ePages services) by:

/etc/init.d/epages6 stop_httpd

/etc/init.d/epages6 start_httpd may have an additional parameter:

/etc/init.d/epages6 start_httpd reload

just reloads the httpd configuration by sending a hangup signal (HUP) to the process

/etc/init.d/epages6 start_httpd graceful

(re)starts the httpd server gracefully (currently open connections are not aborted)

Close/Open Outside Connections

Following command closes outside connections and (re)starts the web server:

/etc/init.d/epages6 start_httpd close

After running this command, connections from outside result in 503 (Service Temporary Unavailable).

Environment variable APACHE_CLOSED_EXCEPT in file /etc/apache2-epages/envvars defines from what hosts internal connections are allowed after closing outside connections.

Re-open your website for outside connections by:

/etc/init.d/epages6 start_httpd open

ePages File Permissions

/etc/init.d/epages6 also can be used to correct UNIX permissions of ePages files (chown/chmod) :

/etc/init.d/epages6 perm all

correct permissions for each ePages file

/etc/init.d/epages6 perm admin

correct permissions in $EPAGES_LOG, $EPAGES_CONFIG, $EPAGES_SHARED/Monitor, $EPAGES/{bin,Setup,Service,RequestRouter,WebAdapter}, /srv/epages/etc, /etc//*epages, /var/epages

/etc/init.d/epages6 perm stores

correct permissions in $EPAGES_STORES

/etc/init.d/epages6 perm webroot

correct permissions in $EPAGES_WEBROOT

/etc/init.d/epages6 perm static

correct permissions in $EPAGES_STATIC

/etc/init.d/epages6 perm apache

correct permissions in $EPAGES_APACHE

/etc/init.d/epages6 perm perl

correct permissions in $EPAGES_PERL

/etc/init.d/epages6 perm cartridges

correct permissions in $EPAGES_CARTRIDGES

/etc/init.d/epages6 perm mysql

correct permissions in $EPAGES/MySQLDumps

/etc/init.d/epages6 perm j

correct permissions in $EPAGES/j

/etc/init.d/epages6 perm … may have following additional parameters:

-d DIR

correct permissions in DIR instead of $EPAGES


use chmod -R … instead of find … -exec chmod; this accelerates the process, but doesn’t follow symbolic links


just change the user, not the mode

Example for additional parameters (accelerate process and use different directory /my/epages):

/etc/init.d/epages6 perm all -f -d /my/epages

ePages Shell Variables

/etc/init.d/epages6 as well as other shell scripts use variables and functions as defined in:


customizable environment variables used while installing ePages (see /etc/sysconfig/epages6 below)


customizable ePages environment variables


non-customizable ePages environment variables (marked as read only below) and ePages Shell Functions (see below)

Never change /var/epages/ The changes will be lost on a subsequent patch installation.

If you want to use the ePages environment variables and functions in a shell, source the file /etc/default/epages6:

  1. /etc/default/epages6

Environment variables in the variable lists below are marked as follows:


variables defined in /var/epages/


variables defined in /etc/default/epages6 that may also occur in /etc/default/epages6.local

neither read-only nor local

variables defined in /etc/default/epages6 that may not occur in /etc/default/epages6.local


/etc/default/epages6 includes additionally /etc/default/epages6.local (if file exists). This can be used in a distributed environment where there is a common /etc/default/epages6 but some variable values differ from host to host. You may redefine all variables mentioned in /etc/default/epages6 in /etc/default/epages6.local that do not describe file paths as well as EPAGES (the only path variable). The enviroment variable list below marks all variables that may redefined in /etc/default/epages6.local as local.


/etc/sysconfig/epages6 contains variables that are used while installing ePages. Such installation variable names always start with EPAGES_INSTALL_. Replacing EPAGES_INSTALL_ by EPAGES_, for some of these variables you’ll find the corresponding variable in /etc/default/epages6. See documentation in /etc/sysconfig/epages6 itself.

The only variable that is used from /etc/sysconfig/epages6 by the running ePages is EPAGES_INSTALL_RUN_SCRIPT. The variable is used in function etc_default (see below) as a fallback to guess the name of the epages project (default: epages6).

The project name is used for naming the source script /etc/default/EPAGES_PROJECT and the run script /etc/init.d/EPAGES_PROJECT. Default values are /etc/default/epages6 and /etc/init.d/epages6.

The name of /etc/sysconfig/epages6 is fix.

Operating System Variables

umask 027 (read-only)

sets umask to 027, i.e. new files get permission -rw-r-----, new directories get drwxr-x---

unset LANG LC_ALL LC_CTYPE LC__FASTMSG (read-only)

we unset language variables for having the same output of some UNIX commands (e.g. ls is localized and has different output depending on LANG)

unset I_WANT_A_BROKEN_PS (read-only)

command ps shall not interprete obsolete command lines

EPAGES_KERNEL (read-only)

the value consists of the first three parts of uname -r, appended by s (for SuSE), r (Red Hat/CentOS) or d (Debian), following values are currently supported:

Red Hat Enterprise Linux 6 / CentOS 6 → 2.6.32r

Red Hat Enterprise Linux 7 / CentOS 7 → 3.10.0r

Debian 7 / 8 → 3.2.0d

EPAGES_ARCH (read-only)

architecture of the system: either i386 (for 32-bit) or x86_64 (for 64-bit)

PATH (read-only)

$EPAGES_PERL/bin:$HTTPD_ROOT/bin is appended to the path; /bin:/usr/bin:/sbin:/usr/sbin is prepended to the path (see functions pathmunge and epages_path / epages_libs below)

LD_LIBRARY_PATH (read-only)

/lib:/usr/lib:/usr/X11R6/lib is prepended to the path (see functions pathmunge and epages_path / epages_libs below)

MAX_NOFD (local)

sets the maximum number of open file descriptors (default: 1024), do not set this unless absolutely necessary

CHECK_NFS (local)

if set, check if RPC port mapper and network status monitor run, do not set this unless absolutely necessary (see function check_nfs)

EPAGES_TZ (local)

time zone of the server (e.g. Europe/Berlin)


if set, ePages supports IPv6 (see How To Setup IPv6)


if set, ePages supports SELinux (see SELinux Context for ePages Applications)


set EPAGES_TEST=timeout_test if you want to use timeout_test instead of /usr/bin/test (see script


stop commands executed by /var/epages/ (or timeout_test) after timeout seconds (see script


if set, ePages cronjobs are permanently ignored


epages project name (default: epages6, see /etc/sysconfig/epages6

EPAGES (local)

epages root directory (default: /srv/epages/eproot)

Database Server Variables

SHUTDOWN_DB_SERVER="Backup" (local)

use database connection as defined in $EPAGES_CONFIG/Database.d/$SHUTDOWN_DB_SERVER.conf for shutting down the database server


install only mentioned business units (one/more of Site Store Master MultiStore)


do not install/patch the site database (=1 for ePages FLEX stores)


do not install the demoshop


set connection to file socket (default: /var/lib/mysql/mysql.sock) or TCP socket (short/long hostname, IP (v4/v6), optionally followed by ;PORT. Examples (space-separated): <tt>shop "shop;3306" shop.domain.dd ";3306" "2001:db8:6:5:4:3:2:1;3306"</tt>


if set, the ePages database server is never started/stopped by /etc/init.d/epages6

Application Server / Request Router

LOCAL_IPS (local)

parameter for epagesService/RequestRouter: comma-separated list of local IPs started by -i, e.g.: <tt>LOCAL_IPS="-i,"</tt>

IP_BINDING (local)

parameter for epagesService/RequestRouter: (un)sets explicit IP binding (empty: unset, -b: set), e.g.: <tt>IP_BINDING=-b</tt>


points to the file with a local copy of the ASPoolDB cache, do not set this unless absolutely necessary


user that runs the application server (default: eprunapp)

AMUSER (local)

epages application monitor user (optional)


if set, the ePages application server support SELinux (see SELinux Context for ePages Applications)


if set, the ePages application server is never started/stopped by /etc/init.d/epages6


if set, the ePages request router is never started/stopped by /etc/init.d/epages6

PERL_NET_HTTPS_SSL_SOCKET_CLASS=<nowiki>Net::SSL</nowiki> (read-only)

perl socket class for https requests, possible values: Net::SSL or IO::Socket::SSL (ePages requires Net::SSL)


verify the hostname in the SSL certificate, must be set to 0 (ePages requires this) if PERL_NET_HTTPS_SSL_SOCKET_CLASS=Net::SSL (PERL_LWP_SSL_VERIFY_HOSTNAME= is the same as PERL_LWP_SSL_VERIFY_HOSTNAME=0)


path to ePages cartridges


path to shared files


path to configuration files


path to log files


path to static files


path to private files


path to public files


path to perl


perl executable


epagesService executable


epages RequestRouter executable

Web Server Variables


group that runs the web server (format: NAME:GID, default: apache:48), see function check_epages_webgroup


user that runs the web server (default: apache)

HTTPD_OPTS (local)

additional options for web server; for example, if you want to use SSL, then you must set HTTPD_OPTS=-DSSL


if set, the ePages web server is never started/stopped by /etc/init.d/epages6


path to web server configuration file zzz-epages-rewrite.conf

HTTPD_ROOT (read-only)

if $EP_HTTPD is executable, HTTPD_ROOT="$EPAGES_APACHE" is set

Java Server Variables

EPAGESJ="$EPAGES/j" (local)

path to Java code

EPAGESJ_USER=epagesj (local)

user that runs the Java servers

MONGOD_USER= (local)

user that runs mongod (default: mongod)

MONGOD_CONF= (local)

configuration file for mongod (default: /etc/mongod.conf)

MONGOD= (local)

path to mongod (default: /usr/bin/mongod). On NUMA hardware (with installed numactl), export MONGOD="numactl --interleave=all /usr/bin/mongod --pidfilepath=/var/log/mongo/", see NUMA.


path to JAVA runtime environment, see function jre_home


path to JAVA executable, see function java_executable

JAVA_HOME="$(dirname "$EPAGES_JAVA")"

parent directory of EPAGES_JAVA


directory with Java server configuration files


directory with Java server log files

ePages Shell Functions

All ePages shell functions are stored in /var/epages/ Provide this functions to your shell by sourcing /etc/default/epages6:

  1. /etc/default/epages6

If you execute all functions described below with option -? you get a short usage message, e.g.:

# . /etc/default/epages6
# show_pids -?
[PS_FORMAT=...] show_pids PID_LIST
PID_LIST: show processes of space separated list in PS_FORMAT

All functions are used in various ePages shell scripts.

Process Management


checkpid PID checks /proc/ if PID is running.


checkpid 1 || echo something is wrong.


get_pidof COMMAND shows all PIDs associated with COMMAND.


# get_pidof httpd
1738 1736 1735 1733 1732 1731 1730 1729 1723


get_pidfile [-p pidfile] [/path/to/program] checks if PID in pidfile (default: /var/run/ is running.

# get_pidfile httpd && echo is running
1723 1729 1730 1731 1732 1733 1735 1736 1738
is running
# get_pidfile -p /var/run/ && echo is running
1723 1729 1730 1731 1732 1733 1735 1736 1738
is running

get_pidfile returns:

  • 0 → program is running

  • 1 → program is dead and /var/run pid file exists

  • 3 → program is not running

  • 4 → status is unknown because of user has insufficient privileges


get_pids returns a space separated PID list either for the specified command (using pgrep -f) or for the specified process ID (using ps -p).

# get_pids -?
get_pids {-c COMMAND | -p PID} [-u USER] [-C] [-P]
-c COMMAND: returns space separated PID list for command
-p PID: returns space separated PID list for PID
-u USER: returns only processes of USER
-C: add child processes to PID list
-P: add parent process to PID list


# get_pids -c mysqld_safe
# get_pids -c mysqld_safe -C
6939 6989
# PS_FORMAT=user,pid,ppid,args show_pids $(get_pids -c mysqld_safe -C)
root  6939 1    /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/ --user=mysql
mysql 6989 6939 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/ --skip-external-locking --socket=/var/lib/mysql/mysql.sock
# get_pids -p 6670
# get_pids -p 6670 -C
6670 6673 6674 6675 6676 6677 6678 6679 6680
# PS_FORMAT=user,pid,ppid,args show_pids $(get_pids -p 6670 -C)
root      6670     1 /usr/sbin/httpd -DSSL
apache    6673  6670 /usr/sbin/httpd -DSSL
apache    6674  6670 /usr/sbin/httpd -DSSL
apache    6675  6670 /usr/sbin/httpd -DSSL
apache    6676  6670 /usr/sbin/httpd -DSSL


show_pids PID_LIST shows processes of the space separated list PID_LIST in a specific format defined by PS_FORMAT. PS_FORMAT defaults to user,pid,ppid,nice,pri,pcpu,time,pmem,vsz,etime,args, user-defined formats are described in man ps.


show_pids $(get_pids -p 6670 -C)
root      6670     1   0  21  0.0 00:00:09  0.4  11968    23:11:46 /usr/sbin/httpd -DSSL
apache    6673  6670   0  15  0.0 00:00:00  0.2  12100    23:11:46 /usr/sbin/httpd -DSSL
apache    6674  6670   0  14  0.0 00:00:00  0.2  12100    23:11:46 /usr/sbin/httpd -DSSL
apache    6675  6670   0  14  0.0 00:00:00  0.2  12100    23:11:46 /usr/sbin/httpd -DSSL
apache    6676  6670   0  14  0.0 00:00:00  0.2  12100    23:11:46 /usr/sbin/httpd -DSSL


softkill PID_LIST stops all processes defined by the separated process list PID_LIST. It first tries to terminate the processes by sending a TERM signal. Then, all processes that can’t be stopped by TERM are killed by sending a KILL signal.

# softkill -?
softkill PID_LIST
PID_LIST: space separated list of processes to kill; first try TERM, then KILL

Daemon Functions


show_daemon DAEMON shows the daemon process of DAEMON (as defined with /etc/init.d/DAEMON) in a specific format defined by PS_FORMAT, see show_pids. show_daemon has no arguments, it returns always only 1 line. show_daemon DAEMON runs /etc/init.d/DAEMON status, so it takes a little longer than get_pids.


# show_daemon httpd
root      6670     1   0  21  0.0 00:00:09  0.4  11968    23:15:44 /usr/sbin/httpd -DSSL
# PS_FORMAT=pid= show_daemon httpd


run_cron {start|stop|show} [USER] starts/stops/shows epages cron processes (all or just for USER).


# run_cron stop ep_appl
Stopping ep_appl cron jobs...
10 5 * * * ep_appl /srv/epages/eproot/Cartridges/DE_EPAGES/Core/bin/ MySQLFullBackup epages6
10 6 * * 6 ep_appl /srv/epages/eproot/Cartridges/DE_EPAGES/Core/bin/ MySQLUpdateStatistics epages6
32 * * * * ep_appl /srv/epages/eproot/Cartridges/DE_EPAGES/Core/bin/ appserver-RotateLogs epages6
crond (pid  6918) is running...
# run_cron stop ep_appl
Stopping ep_appl cron jobs...
crond (pid  6918) is running...

run_cron is used by /etc/init.d/epages6.


rs_show [return code] prints [OK] or [FAILED] on screen and returns return code (default: $?). This functions is useful only in run scripts.


rs_status [-p pidfile] [-l lockfile] [program] shows the status of the program (or PID in pidfile).

Example: # rs_status httpd httpd (pid 1723 1729 1730 1731 1732 1733 1735 1736 1738) is running…

rs_status returns:

  • 0 → program is running

  • 1 → program is dead and /var/run pid file exists

  • 2 → program is dead but subsys locked

  • 3 → program is not running

  • 4 → status is unknown because of user has insufficient privileges


rs_start [-bg] [-q|-Q] [-l logfile] [-u user] [-p pidfile] {program} starts program in run script.


  • -bg : start program in background

  • -q : redirect STDOUT to /dev/null (or to logfile if set)

  • -Q : redirect STDERR to /dev/null (or to logfile if set)

  • -l : write output (depending in -q and -Q) to logfile. If neither -q nor -Q is set, write both STDOUT and STDERR to logfile.

  • -u : run program by user

  • -p : write PID into pidfile (default: /var/run/


rs_stop [-p pidfile] [-d delay] [program [-signal]] stops program in run script.


  • -p : read PID from pidfile (default: /var/run/

  • -d : wait up to delay seconds for stopping process, after delay kill -KILL process

  • -signal : stop process with signal (e.g. -KILL; default: -TERM)

Directory/Path Functions


pathmunge shortens directory paths (semicolon-separated strings as PATH or LD_LIBRARY_PATH) so that in the resulting path each directory occurs only once (in the first occurrence, latter occurrences are deleted) and only if it exists.

With one argument, it just trims the path. With two arguments, all directories in the first argument are prepended to the second argument only if they not already exist in the second argument:

# pathmunge -?
TARGET_PATH: semicolon-separated path to change
SOURCE_PATH: semicolon-separated path to prepend
$(pathmunge /usr/bin:/bin:/usr/bin) == /usr/bin:/bin
$(pathmunge /usr/bin /bin:/usr/bin) == /bin:/usr/bin
$(pathmunge /usr/bin /bin)          == /usr/bin:/bin
  • In the first example above the TARGET_PATH is only trimmed.

  • In the second example above /usr/bin is not prepended to TARGET_PATH because it already exists in TARGET_PATH.

  • In the third example above /usr/bin not prepended to TARGET_PATH because it doesn’t exist yet in TARGET_PATH.


jre_home returns the best guess for the path to JRE directory, depending on the operating system/version and typical places where the JRE directory is expected to be. Typically, the value of jre_home is used to set the ePages environment variable EPAGES_JAVA.


# jre_home

Used in /etc/default/epages6:



java_executable returns the best guess for the path to the java executable file. Typically, the value of java_executable is used to set the ePages environment variable JAVACMD.


# java_executable

Used in /etc/default/epages6:



etc_default PREFIX returns the best guess for the ePages environment variables file (default: /etc/default/epages6), depending on:

  1. the installation prefix argument PREFIX

  2. the variable EPAGES_PROJECT

  3. the variable EPAGES_INSTALL_RUN_SCRIPT (from file /etc/sysconfig/epages6, see /etc/sysconfig/epages6

  4. the installation directory of the RPM package epages-common

  5. the file /etc/default/epages6 (if exist)

  6. the first file of /etc/default/epages6*


# etc_default FOOBAR


mysqld_name returns the name of the MySQL server (mysql or mysqld) if the RPM package epages-mysqld is installed. Otherwise it returns nothing.


# mysqld_name

mysqld_name is used by /etc/init.d/epages6 in order to decide if the MySQL server is a ePages MySQL server. If so, /etc/init.d/epages6 start_db (resp. stop_db) starts/stops the installed MySQL server. Otherwise, /etc/init.d/epages6 start_db does nothing.


httpd_name returns the name of the Apache httpd server provided by the operating system (httpd or apache2) if installed. Otherwise returns nothing.


# httpd_name

httpd_name is used by httpd_confd.


httpd_confd returns the Apache httpd server configuration directory (depending on the server provided by the operating system) where ePages configuration files should be stored. If the directory exists, the directory is returned, otherwise nothing.

httpd_confd epages returns the Apache httpd server configuration directory only if the ePages configuration file zzz-epages-httpd.conf exists inside.


# httpd_confd

Result: directory (where to put ePages configuration files) /etc/httpd/conf.d exists.


# httpd_confd epages

Result: ePages configuration file /etc/httpd/conf.d/zzz-epages-httpd.conf exists.

httpd_confd epages is used by /etc/init.d/epages6 in order to decide if the httpd server is a ePages httpd server. If so, /etc/init.d/epages6 start_httpd (resp. stop_httpd) starts/stops the installed httpd server. Otherwise, /etc/init.d/epages6 start_httpd does nothing.

epages_path / epages_libs

. /etc/default/epages6 adds ePages directories to the end of PATH:

# grep PATH= /var/epages/
PATH=$(pathmunge "$PATH:$EPAGES_PERL/bin:$HTTPD_ROOT/bin")

ePages directories cannot be put in the beginning of PATH because then the operating system would use ePages perl ($PERL), not its own perl. The operating system has a lot of perl scripts that rely on the operating system perl; those scripts would not work anymore.

The same holds for LD_LIBRARY_PATH. ePages libraries and operating system libraries may differ slightly (e.g. in the version). We cannot add libraries that are provided by ePages to this path, this would lead to conflicts in binary files.

On the other hand, ePages scripts need ePages perl. Thatswhy there are the two functions epages_path resp. epages_libs that return PATH resp. LD_LIBRARY_PATH for the ePages environment:

# epages_libs -?
prepends LD_LIBRARY_PATH with epages libdirs
# epages_libs
# epages_path -?
prepends PATH with EPAGES_PERL/bin
# epages_path

epages_libs and epages_path are used in $PERL and /etc/init.d/epages6:

# cd /srv/epages/eproot
# grep epages_libs */bin/* /etc/init.d/epages6
/etc/init.d/epages6:PATH="$(epages_path)" LD_LIBRARY_PATH="$(epages_libs)" "$EP_HTTPD" -f "$HTTPD_ROOT"/conf/httpd.conf

Various Functions


column COL sets start column COL for echo.


# echo "123$(column 2)x"
# echo "123$(column 3)x"


em OPTIONS STRING (em for emphasize) echoes a colored STRING (depending on the OPTIONS) on the terminal, if the environment variable TERM is set and not set to raw or dumb. Otherwise only the STRING is echoed.

# em -?
OPTIONS: -s(trong) -d(im) -u(nderline) -i(nverse) -h(idden) -x(out)
COLOR:   -L(black) -R(ed) -G(reen) -B(lue) -Y(ellow) -P(ink) -C(yan) -W(hite)
BGCOLOR: -l(black) -r(ed) -g(reen) -b(lue) -y(ellow) -p(ink) -c(yan) -w(hite)

Example (first string is blue, bold, with background color cyan; second string is red, crossed out, and inverse):

echo "$(em -B -c -s first) $(em -R -x -i second)"

Following shorthand functions exist:

  • R … stands for em -R …

  • G … stands for em -G …

  • B … stands for em -B …

  • Y … stands for em -Y …

  • P … stands for em -P …

  • C … stands for em -C …


echo "$(G this is green text)"


timeout_test does a file test as /usr/bin/test would do. The differnce is that the test stops after EPAGES_TIMEOUT seconds. This is useful for example if the file to test is stored on an NFS server mount which is not reachable anymore. /usr/bin/test would never return.

timeout_test uses, see below. If EPAGES_TEST=timeout_test is set in /etc/default/epages6 then test is aliased to timeout_test in /var/epages/

[[ $EPAGES_TEST = timeout_test ]] && alias test=timeout_test

Use timeout_test as you would use /usr/bin/test for testing files:

# timeout_test -?
FILE_TEST_OPERATOR: see 'man test', e.g. one of: -f -d -e -x
TEST_OBJECT: file/directory to test


timeout_test -x /nfs/bin/some/executable && echo "file is executable"


ipcrm_user USER runs ipcrm -m and ipcrm -s for all processes owned by a specific USER (see man ipcrm).

Examples (from /etc/init.d/epages6):

ipcrm_user $EPAGES_WEBUSER
ipcrm_user $EPAGES_APPUSER


started_by_rpm PID returns 0 (success) if one of ancestors of process ID PID is rpm/yum/zypper, otherwise 1 (failure).

Sometimes a shell script must know, if it executed by rpm or on the command line. For example, if the script is executed by rpm, it cannot update RPM packages by itself (this would lead to a conflict).

Example (from patch Makefile.PL):

started_by_rpm $$ || yum -y install graphviz


check_nfs returns 0 (success) if the NFS client process rpc.statd is running, else 1 (failure). The running NFS client process rpc.statd is necessary for mounting ePages ahres in a distributed installation.

If the environment variable CHECK_NFS=1 is set (in /etc/default/epages6), /etc/init.d/epages6 always executes check_nfs when starting (any) services. If check_nfs fails, services are not started:

# grep check_nfs /etc/init.d/epages6
start*) [ -n "$CHECK_NFS" ] && { check_nfs || exit $?; } ;;


set_selinux4epages sets SELinux file context for ePages files if:

If prerequisits met, set_selinux4epages runs:

/var/epages/ --set $PERL_CGI

where $PERL_CGI is set to --perl-cgi if EPAGES_ENABLE_PERL_CGI is set (see Operating System Variables).

set_selinux4epages is executed when starting ePages by /etc/init.d/epages6.


check_epages_webgroup checks the environment variable EPAGES_WEBGROUP=GROUP_NAME:GROUP_ID as defined in /etc/default/epages6 and returns the GID of the web group:

# check_epages_webgroup -?
check_epages_web {*start*/*stop*} EP_DEFAULT
EP_DEFAULT: checks (e.g. /etc/default/epages6) for EPAGES_WEBGROUP= setting
*start*: add missing UNIX user as defined in EPAGES_WEBGROUP=
returns: GID of epages web group

It is only used by /etc/init.d/epages6 and should not be used elsewhere (including the command line):

# grep check_epages_webgroup /etc/init.d/epages6
EPWEBID=$(check_epages_webgroup $1 "$EP_DEFAULT" )
  1. If EPAGES_WEBGROUP is empty, set GROUP_NAME to ep_web

  2. If EPAGES_WEBGROUP has the wrong format (not: GROUP_NAME, then GROUP_ID separated by semicolon) → exit 1 (failure)

  3. If GROUP_NAME and GROUP_ID exist in /etc/group, but do not belong together → exit 1 (failure)

  4. only if argument is start: If the web group does not exist, create it: groupadd -g $GROUP_ID $GROUP_NAME; if this fails → exit 1 (failure)

  5. If ePages users ep_appl or $EPAGES_APPUSER (default: eprunapp) do not belong to the web group → exit 1 (failure)

  6. If everything went right, echo the GID of the web group


# check_epages_webgroup start /etc/default/epages6


my_host {IP/hostname} checks if IP/hostname belongs to host that executes my_host depending on ifconfig, DNS and /etc/hosts.


# my_host localhost && echo yow
# my_host ::1 && echo has IPv6
has IPv6
# echo ' my_name' >> /etc/hosts
# my_host my_name || echo nope
# ip addr show |  awk '/^[[:space:]]*inet/{sub(/\/.*/,"",$2); print $2}'
# sed -i 's,,,' /etc/hosts
# my_host my_name && echo yow
# host $(hostname) has address
# my_host && echo yow
# my_host 2001:4bd8:2:2:250:56ff:fe00:1199 && echo yow

ePages Shell Scripts

Scripts in /var/epages

/var/epages/ runs COMMAND and terminates it by SIGNAL after TIMEOUT (default: ${EPAGES_TIMEOUT:-5}) seconds if it hasn’t finished yet:

  /var/epages/ -c 'COMMAND' [-t TIMEOUT] [-s SIGNAL]
  -c: command to execute
  -t: terminate command after TIMEOUT seconds (default: 5)
  -s: terminate command with SIGNAL (not TRAP,ALRM; default: TERM)
  time /var/epages/ -c 'sleep 10' -t 1 -s KILL

The return value of /var/epages/ is either the return value of the command (if in time), else 127.

The function timeout_test defined in /var/epages/ uses /var/epages/

/var/epages/ -c "/usr/bin/test $HOW '$@'"

/var/epages/ processes configuration files in INI format similiar to our perl module DE_EPAGES::Core::API::IniConfig but it is written in awk, not in perl:

# /var/epages/
Usage: -f file { [-s section] [-k key] } [-v value [-r subst] | -g] [-i] [-p {k|s|ks}]
  -f: INI file name
  -s: section (REGEX) as in [section]
  -k: key (REGEX) as in key=
  -v: set key to value
  -r: replace subst (REGEX) with value in key
  -g: get key value (first occurrence)
  -i: edit file in place
  -p: plain key and/or section (do not quote)

Contrary to DE_EPAGES::Core::API::IniConfig, some additional features are added:

  • INI file may contain no [section], then any line KEY=VALUE is recognized as key-value pair, e.g.:

    # /var/epages/ -f /etc/default/epages6 -k EP_RR -g
  • Values may be here documents (you just can get here documents, not set), e.g.:

    # cat patch/zzz-epages-httpd.conf-patch.ini
    [RequestHeader unset Range]
    <IfModule mod_headers.c>
      RequestHeader unset Range
      RequestHeader unset Request-Range
    # /var/epages/ -f patch/zzz-epages-httpd.conf-patch.ini -s 'RequestHeader unset Range' -k by -g
    <IfModule mod_headers.c>
        RequestHeader unset Range
        RequestHeader unset Request-Range
  • Get all section names:

    # /var/epages/ -f patch/zzz-epages-httpd.conf-patch.ini -g
  • Get all key-value pairs for section:

    # /var/epages/ -f patch/zzz-epages-httpd.conf-patch.ini -s 'RequestHeader unset Range' -g FILE has as argument a symbolic link. If the file isn’t a symbolic link or does not exist at all, does nothing.

If FILE does not end in .lnk, FILE moves the symlink to FILE.lnk and writes the dereferenced version to FILE:

  1. delete FILE.lnk

  2. move FILE to FILE.lnk

  3. create FILE by dereferencing FILE.lnk

If FILE ends in .lnk, FILE.lnk writes FILE to FILE.lnk and moves FILE.lnk to FILE.

  1. if FILE exists, copy it to FILE.lnk and delete it

  2. move FILE.lnk to FILE

In distributed installations, after installing the first part of ePages on the first server, you should share installed ePages directories. Then, all other servers of the epages installation may mount those NFS shares before starting the ePages installation to get a common file system base.

This is done by /var/epages/ On the first server named FILESERVER share the ePages directories:

  • /srv/epages/etc/sysconfig

  • /srv/epages/eproot/Shared

by executing command:

# /var/epages/ -share

On all other servers mount the shares provided by FILESERVER:

# /var/epages/ -mount FILESERVER


# /var/epages/
Usage: {  -share | -mount FILESERVER | -unmount | -unshare }
  -share: share /srv/epages with other hosts
  -mount: mount /srv/epages from FILESERVER
  -unmount: unmount /srv/epages
  -unshare: unshare /srv/epages

For more information on distributed ePages installation see ePages Installation Guide for Linux.

If you installed epages by yum, you may deinstall epages by executing yum groupremove epages.

But this command does not remove files that have changed (or that are not part of a ePages RPM). To remove ePages completely from your server, run /var/epages/ The command deletes all ePages RPM packages, files and databases:

# /var/epages/
Installed ePages RPMs:
epages-mysqld-6.12.0-0 epages-appsrv-6.12.0-0 epages-mysql-6.12.2-0 epages-perl-6.12.2-0 epages-patch-6.12.3-0 epages-common-6.12.2-0 epages-requires-2.6.18r-0 epages-release-6.12-0
Do you really want to delete those ePages RPMs? (y/n): n
Installed ePages databases:
sitedb storedb
Do you really want to delete those ePages databases? (y/n): n
Installed ePages files:
Do you really want to delete all ePages files? (y/n): n /

Files outside $EPAGES (default: /srv/epages/eproot) are patched by /var/epages/ The script is executed in target update_os both in the patch Makefile.PL:

update_os: -d sh

and in DE_EPAGES/Makefile.PL:

update_os: -d "$(PATCH_DIR)"/sh

/var/epages/ should be executed only by those two targets, there is no use to run the command on the command line, ignore it simply.

# /var/epages/
  EPAGES_PROJECT: envvar of the epages project (default: epages6)
  -d: directory with patch.conf
  -R: restore

/var/epages/ reads file PATCH_DIR/patch.conf that contains all information on how to patch files outside $EPAGES.

In the patch, PATCH_DIR is sh/, you’ll find this PATCH_DIR in $EPAGES_SHARED/Patches/patch_x_y_z/sh/ (default).

File patch.conf consists of various sections:

# -f patch.conf -g

Each section shows the path for the new files. For the target patch, the first part (until /) is expanded as environment variable (or to / if not exist); exceptions:

  • EPAGES_ETC → TARGET=$(dirname "$EPAGES")/etc

  • ETC_HTTPD_CONFD → TARGET=$(httpd_confd epages)

Each section has key-value pairs, the key BASE is ignored. Keys are the files to handle, values are:

  • patch: copy the new file to the old file only if the old file already exists

  • add: copy the new file to the old file

  • del: delete the old file

  • else, the value is taken as a configuration file stored in PATCH_DIR which shows how to patch the file (then, the file is patched by

Example file patch.conf:



  1. Copy PATCH_DIR/EPAGES/Apache/bin/ (where PATCH_DIR is the argument of the option -d) to $EPAGES/Apache/bin/ (only if target exists)

  2. Copy PATCH_DIR/EPAGES/Apache/conf/extra/httpd-default.conf.initial to $EPAGES/Apache/conf/extra/httpd-default.conf.initial (create directories if necessary)

  3. Delete file $EPAGES/Apache/conf/extra/httpd-default.conf.ini

  4. Patch file $EPAGES/Apache/conf/extra/httpd-default.conf by running with option -p PATCH_DIR/patch/httpd-default.conf-patch.ini

There is one exception for source files in EPAGES_ETC/{default,init.d}/epages6.ept. If such a file changes, /etc/{default,init.d}/epages6 is changed as well (accordingly):


Replace EPAGES_PROJECT in EPAGES_ETC/init.d/epages6.ept and copy the result to /etc/init.d/epages6.


Copy EPAGES_ETC/default/epages6.ept to /etc/default/epages6 and set the environment variables inside to the current values. Do not touch /etc/default/epages6.local. This work is done by the script /var/epages/

# /var/epages/
Usage: -s epages6 -t epages6.ept [-i]
  -s: file to change (e.g.: /etc/default/epages6)
  -t: new template file (e.g.: /srv/epages/etc/default/epages6.ept)
  -i: edit file to change in place

/var/epages/ -f FILE -p CONF patches FILE by the rules given in CONF:

# /var/epages/
Usage: -f file -p patch.ini [-i]
  -f: file to patch
  -p: ini file with patch instructions
  -i: edit file in place

/var/epages/ uses and is used by, e.g. (see example patch.conf in / above):

/var/epages/ -f $EPAGES/Apache/conf/extra/httpd-default.conf -p PATCH_DIR/patch/httpd-default.conf-patch.ini

Each [section] in CONF has two keys: subst and by. Then the rule is that if section does not exist in FILE, substitute subst by by, e.g.:

[ServerTokens Prod]
subst=ServerTokens Full
by=ServerTokens Prod

means: if ServerTokens Prod does not exist in FILE, substitute ServerTokens Full by ServerTokens Prod.

If you want to delete/shorten a string in the FILE, use a section name that never exist:

subst=<FilesMatch .+?\(.+?png\|wav\|xml.*?\).*?>
by=<FilesMatch \.>

means: if pngwavxml does not exist in FILE (it won’t), substitute regexp <FilesMatch .+?\(.+?png\|wav\|xml.*?\).*?> by <FilesMatch \.>.

section name

an extended regexp as egrep uses, it must not contain double quotes (") (or they must be quoted: \")


a perl regexp, it must not contain a percent sign (%) (or it must be quoted: \%); $ENV{…} is evaluated, unless preceded by backslash (\)


a string; $ENV{…} is evaluated, unless preceded by backslash (\)

  • If subst= is caret (^), then by= is prepended to FILE.

  • If subst= is dollar ($), then by= is appended to FILE.

Scheduler Scripts

All scheduler scripts (scripts for cron jobs) are stored in $EPAGES_CARTRIDGES/DE_EPAGES/Core/bin.

$EPAGES_CARTRIDGES/DE_EPAGES/Core/bin/ -f 'FILES -m TIME[dm] DIR' deletes files older than TIME matching FILE in DIR:

Usage: [-t] -f 'FILES' -m TIME[dm] DIR1 DIR2 DIR3...
  -f FILES    : remove files with specific file name (req.)
  -m TIME[dm] : remove files older than TIME (d - days, m - minutes, req.)
  -t          : do not remove, just test

$EPAGES_CARTRIDGES/DE_EPAGES/Core/bin/ is used in $EPAGES_CONFIG/Scheduler.d/runserver-DelObsoleteMonitor.env:

# search directory/ies for monitor files (separated by ' ')
# -f FILES: remove files with specific file name (must be set)
FILES="-f '*.html *.response'"
# -m TIME: remove files older than TIME[dm] (d:days, m:minutes, must be set)
TIME="-m 1d"
# what command options?

$EPAGES_CARTRIDGES/DE_EPAGES/Core/bin/ rotates log files:

Usage: [-t] { -c CONF | [OPTIONS] DIR1 DIR2 DIR3... }
  -t             : do not compress, just test
  -c CONF        : use options as defined in file CONF
  -s SIZE[ckm]   : required size (in bytes, KB, MB) to compress
  -d DAYS        : remove compressed files older than DAYS (w/o: don't remove)
  -a DIR         : move compressed files into archive DIR
  -e SUFFIX_LIST : compress only files ending in suffix (default: [._]log)
  -z ZIPPER      : use compression instead of 'gz' (allowed: gz,bz2,lzo,zip,Z)
  -v             : verbose output

$EPAGES_CARTRIDGES/DE_EPAGES/Core/bin/ is used in $EPAGES_CONFIG/Scheduler.d/appserver-RotateLogs.env:

# search directory/ies for log files (separated by ' ')
# -s SIZE[ckm]: required size (in bytes, KB, MB) to compress
SIZE="-s 30m"
# -d DAYS: remove compressed files older than DAYS (unset -> don't remove)
# -a DIR: move compressed files into ARCHIVE directory
# -z ZIPPER: use compression instead of 'gz' (allowed: gz,bz2,lzo,zip,Z)
# what command options?


$EPAGES_CARTRIDGES/DE_EPAGES/Core/bin/ -c /export/raid5/share/conf/logfilemgmt.conf

with /export/raid5/share/conf/logfilemgmt.conf ( is executed repeatedly with the arguments of each line):

-s 40m -d 30 -z bz2 /var/log
-s 40m -d 30 -z bz2 $BACKUP_LOG_DIR

$EPAGES_CARTRIDGES/DE_EPAGES/Core/bin/ -a TO [-s SUBJECT] -f FILE is a really simple mail-sender. It sends the contents of FILE to TO (with SUBJECT):

usage: $EPAGES_CARTRIDGES/DE_EPAGES/Core/bin/ -a ep_appl@localhost [ -s 'Output from' ] -f Backup.log
   -a: addressee (e-mail address) (mandatory)
   -s: e-mail subject (optional)
   -f: name of file to sent (mandatory)

$EPAGES_CARTRIDGES/DE_EPAGES/Core/bin/ uses mail resp. mailx to send the mail, sending authorized mails is not possible.


$EPAGES_CARTRIDGES/DE_EPAGES/Core/bin/ is used by if no other (more fancy perl) mail script is found. Literally, it is not used anymore.

$EPAGES_CARTRIDGES/DE_EPAGES/Core/bin/ starts/stops/shows ePages schedulers. It is used by the shell function run_cron which itself is used by /etc/init.d/epages6, see Starting/Stopping ePages.

ePages cron jobs may be debugged by adding Debug=1 to the section of the scheduler you want to debug in $EPAGES_CONFIG/Scheduler.conf. Debug shell schedulers defined in $EPAGES_CONFIG/Scheduler.d/*.env by adding DEBUG=1 to the .env file.

ePages schedulers may be debugged while running or while starting/stopping:

debug running schedulers (debug output is written to /tmp/SCHEDULER-DATE.debug)

set: Debug=1 in a Scheduler.conf section, this debugs the running scheduler immediately, don’t restart the scheduler.

debug schedulers with IsActive=0 (debug output is written to /tmp/SCHEDULER-DATE.debug)

set: Debug=1 in a Scheduler.conf section and run manually, see

debug starting schedulers (debug output is shown on the terminal)


debug stopping schedulers (debug output is shown on the terminal)


Do not set Debug=1 permanently in a productive environment, this consumes a lot of ressources and a lot of files and e-mails are written. is a wrapper script around the scheduler script itself. run each ePages scheduler:

# /etc/init.d/epages6 show_cron
Showing epages cron jobs...
5,10,15,20,25,30,35,40,45,50,55 * * * * eprunapp /srv/epages/eproot/Cartridges/DE_EPAGES/Core/bin/ ClearTrash epages6
0 4 * * * eprunapp /srv/epages/eproot/Cartridges/DE_EPAGES/Core/bin/ PurgeSessions epages6
10,40 * * * * eprunapp /srv/epages/eproot/Cartridges/DE_EPAGES/Core/bin/ SendScheduledNewsletters epages6
35 2 * * * eprunapp /srv/epages/eproot/Cartridges/DE_EPAGES/Core/bin/ SendShopCountMail epages6

The first five fields (space separated) of each cron job line designate the date when the job will be executed: minute, hour, day of month, month, and day of week (see man 5 crontab). The sixth field contains the user who runs the command. The rest of the line is the command to be executed.

For example, eprunapp runs each day at 4:00 a.m. the command /srv/epages/eproot/Cartridges/DE_EPAGES/Core/bin/ PurgeSessions epages6. uses following arguments:

  -d <DURATION>:
   max duration the cronjob may take without a next instance reports an error
   DURATION is one of:
   <MINUTES> (e.g. -d 56)
   <HOURS>:<MINUTES> (e.g. -d 7:30)
   <DAYS>-<HOURS>:<MINUTES> (e.g. -d 3-00:00)
   path to perl script (default: $EPAGES_CARTRIDGES/DE_EPAGES/Core/bin/wrapScheduler.PL)
    path to ini file (default: $EPAGES_CONFIG/Scheduler.conf)
  -g GROUP
   name of the group the script belongs to
   either file  SCRIPT_NAME.env in $EPAGES_CONFIG/Scheduler.d/
   OR section SCRIPT_NAME in $EPAGES_CONFIG/Scheduler.conf
   NAME as defined by /etc/default/NAME (default: epages6)
   OR own:NAME (use own, not ePages scheduler; set environment)
   OR own: (use own, not ePages scheduler; don't set environment)

SELinux Scripts

SELinux scripts are stored in /var/epages.

Apache Scripts

Following Apache scripts are stored in /usr/sbin. creates a self-signed SSL certificate that may be used by a ePages test webserver for SSL support.

# /usr/sbin/ -?
Usage: [-h HOST] [-b BITS] [-d DAYS] [-c CONF_DIR]
 -h host: certificate host name (default: HOSTNAME)
 -d days: certificate validation period in days (default: 1)
 -b bits: key size in bits (default: 2048)
 -c dir:  store certificates in apache conf directory (default: /tmp/cert.4728)
Example: -d 365 -b 4092 -c /etc/httpd