ONYX - 9.0 - Exploitation - Guide d'exploitation ONYX Server sur Linux/en

Différence entre versions

De MappingDoc
(Page créée avec « 5- Start the Mapping spooler /apps/mapping/bin/map_daemon start »)
Ligne 198 : Ligne 198 :
 
4- Delete the flag file /apps/mapping/spool/map_daemon.ID
 
4- Delete the flag file /apps/mapping/spool/map_daemon.ID
  
5- Démarrer le spooler Mapping
+
5- Start the Mapping spooler
 
  /apps/mapping/bin/map_daemon start
 
  /apps/mapping/bin/map_daemon start
  

Version du 8 août 2019 à 13:04

Autres langues :
English • ‎français

Introduction

This article provides you with examples of operations on ONYX Server under Linux. This needs to be adapted according to your internal processes.

This only regards ONYX Server. The administration of Apache web server (stop / restart) is not described in this article.

General operations

Selecting the Mapping instance

Several different ONYX Server instances can be installed on the same Unix/Linux server. This way, specifying the Mapping environment is required before entering any command. This is done by changing the MAPPING_PATH environment variable.

In interactive mode: with the "mappingenv" command

-bash-4.2$ mappingenv
Which environment must be changed:
1 : Mapping_PROD   /apps/mapping/conf/mapping.conf 8002
Enter the name or number of the environment:1
bash-4.2$

The list of environments is is based on the /etc/mappingtab file

The mappingenv command is located in " /bin " by default

In a script: The MAPPING_PATH environment variable must be exported with the complete path of the mapping.conf file which corresponds to the desired Mapping environment.

export MAPPING_PATH=/apps/mapping/conf/mapping.conf

Log files

General information on log files

Most Mapping log files are not in text format, they thus cannot be edited as is. There are two methods used to see them:

  • Via the Mapping Web interface
  • Using the /apps/mapping/bin/map_log_txt command


For more information on this command:

/apps/mapping/bin/map_log_txt --help

Display example of the content of the log file of the map_lpd:

/apps/mapping/bin/map_log_txt -log_file:/apps/mapping/spool/logs/map_lpd.log

Common log files

Most log files are located in the /apps/mapping/spool/logs folder.

Log file examples:

<name of the queue>.log Logs linked to queues (printer or entry points)
map_daemon.log General log of the spooler
map_lpd.log Log of the LPD server
map_lpr.log Log of the LPR Mapping client if called in a command line

To access it via the interface: "Main menu" / "View log"

Log files linked to standard outputs and errors

/apps/mapping/temp/stdout.txt
/apps/mapping/temp/stderr.txt

These are text files which can be edited as is without needing to be converted.

Log files of the jobs in the spooler

Each job as its own log file. These files are located in the /apps/mapping/spool/global file. Their name starts with the letter L followed by the number of the job (MAP_JOBNUM).  

Processes

Description of the main Mapping processes

The following processes are frequently seen when displaying the list of current processes. This is often done using the following command:

ps -eaf | grep map
map_daemon Processes of the spooler which allow jobs to be managed in the queues.
map_lpd Recovery process of the jobs sent via LPR. This is a derivative of the map_daemon process.
map_splf Process which notably allows you to add a job in a queue. This is a derivative of the map_lpd process, it communicates with the map_daemon process via the port defined by the PORT_SOCKET_DAEMON parameter in the mapping.conf file. It can also be directly triggered in command line to manage queues or jobs.
map_exec Process which handles jobs in queues to apply processes to them (workflow, script execution, delivery to a printer…). This is a derivative of the map_daemon process. There is one map_exec per queue being processed.
map_lpr Process which sends a printing stream to a printer using the LPR protocol. This is a derivative of the map_exec process. It can also be directly triggered in command line.
map_809 Execution Process of a Workflow. This is a derivative of the map_exec process.
mapcpysplf Process which calls for the mapping of a document. It can be triggered in command line, in a script, in the workflow (map_809)…
map_815UCS Mapping processus of a document (called by the mapcpysplf command).
map_mail Process which sends an e-mail with an attachment.
map_scanfolder Process linked to a robot which allows you to monitor files in a folder so as to launch a workflow processing on each of them.

Other processes with the prefix " map_ " can also be seen, notably if they are called via scripts or in the workflow.

Starting and stopping Mapping processes

Starting the spooler

The following command launches the map_daemon process as well as its derivative map_lpd

export MAPPING_PATH=/apps/mapping/conf/mapping.conf 
/apps/mapping/bin/map_daemon start

When starting the map_daemon process, a flag file which contains the process identifier of map_daemon process is created in the spooled file folder. The process cannot start because of it.

/apps/mapping/spool/map_daemon.ID
Stopping the spooler

The following command stops the map_daemon process as well as its derivative map_lpd

export MAPPING_PATH=/apps/mapping/conf/mapping.conf
/apps/mapping/bin/map_daemon stop

Caution: if "scanfolder" robots processing consists in sending a file to a queue of the spooler, stopping the map_daemon process will result in errors each time a file is processed. It is therefore essential to stop the "scanfolder" robots before stopping the map_daemon process.

Starting the "scanfolder" robots

The following command starts a "scanfolder" robot

export MAPPING_PATH=/apps/mapping/conf/mapping.conf
/apps/mapping/bin/map_scanfolder -name:nom_du_robot

Example of a script to start all the robots:

export MAPPING_PATH=/apps/mapping/conf/mapping.conf
LISTROBOT=`/apps/mapping/bin/map_scanfolder -listRobot | awk ' { print $2 } '`
for ROBOT in $LISTROBOT
do
/apps/mapping/bin/map_scanfolder -name:${ROBOT}
done

When starting the map_scanfolder process, a flag file contenant le process identifier of the map_scanfolder process is created in temp folder. The process cannot start because of it. It needs to be deleted.

/apps/mapping/temp/_apps_mapping_temp_nom_du_robot_map_scanfolder.ID

Caution: deleting this .ID file should only be done if the robot is not being run. When deleting this file, launching another instance of the same robot is possible which causes concurrency conflicts.

Stopping the "scanfolder" robots

The following command stops a "scanfolder" robot

export MAPPING_PATH=/apps/mapping/conf/mapping.conf
/apps/mapping/bin/map_scanfolder -stop -name:nom_du_robot

Example of a script to stop all the robots:

export MAPPING_PATH=/apps/mapping/conf/mapping.conf
LISTROBOT=`/apps/mapping/bin/map_scanfolder -listRobot | awk ' { print $2 } '`
for ROBOT in $LISTROBOT
do
/apps/mapping/bin/map_scanfolder -stop -name:${ROBOT}
done

Processes to monitor

map_daemon and map_lpd

These 2 processes are services and need to be run incessantly. Because they are often forked, there may be several of these processes at some point.

-bash-4.1$ ps -eaf | grep map_
mapadmin 29551     1  1 Oct25 ?   04:00:29 /apps/mapping/bin/map_daemon start
mapadmin 27424 29551  0 Oct30 ?   00:00:00 /apps/mapping/bin/map_lpd -port:515 -nbfork:100
map_scanfolder

There are as many map_scanfolder processes as there are robots being executed. They can be identified with the "-name" option. These processes do not depend on one another, neither do they depend on the map_daemon process.

mapadmin   8271  1  0 17:02 ? 00:00:00 /apps/mapping/bin/map_scanfolder -name:test
httpd

To check that Apache runs smoothly, use the httpd process. Because this process is often forked, several lines can be seen in the list of processes.

-bash-4.2$ ps -eaf | grep httpd
apache    4590 11849  0 10:56 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    4874 11849  0 08:23 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    4876 11849  0 08:23 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    4890 11849  0 08:23 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
root     11849     1  0 oct.15 ?       00:01:42 /usr/sbin/httpd -DFOREGROUND
apache   15641 11849  0 08:54 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   16301 11849  0 08:56 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND

In case a Mapping process crashes

map_daemon crashed

1- Try stopping the Mapping spooler properly:

export MAPPING_PATH=/apps/mapping/conf/mapping.conf
/apps/mapping/bin/map_daemon stop

2- Stop the active scanfolder processes properly (see starting and stopping Mapping processes)

3- Kill (kill -9) the other mapping processes which are still active:

  • map_daemon
  • map_lpd
  • map_exec
  • map_lpr
  • map_809

It is worth noting that processes can become derivatives of the system process (PID=1) in case the process they originate from crashes, common characteristic: they are owned by "mapadmin".

Example (adapt this depending on your system and its configuration):

ps -f -U mapadmin | grep -v bash | grep -v "ps \-f" | grep -v "UID" | while read LINE
do
 PID=`echo $LINE | awk ' { print $2 } '`
 kill -9 $PID
done

4- Delete the flag file /apps/mapping/spool/map_daemon.ID

5- Start the Mapping spooler

/apps/mapping/bin/map_daemon start
Crash du map_lpd

Si le processus map_daemon est toujours actif, il est possible de redémarrer le map_lpd à l’aide de la commande suivante :

export MAPPING_PATH=/apps/mapping/conf/mapping.conf
/apps/mapping/bin/map_control -start_lpd
Crash d’un robot « scanfolder »

Lors du démarrage d'un robot, un fichier avec le nom du robot et l'extension ".ID" est créé, ainsi qu'un fichier avec le numéro de process et l'extension .pid Exemple :

_apps_mapping_temp_nom_du_robot_map_scanfolder.ID
4656.pid

En cas de crash du robot, ces fichiers ne sont pas supprimés et empêche le redémarrage du robot. Par conséquent, pour permettre le redémarrage du robot, le fichier « .ID » correspondant au robot arrêté doit être supprimé du répertoire « /apps/mapping/temp »

Opérations de maintenance

Nettoyage courant

Les commandes suivantes peuvent être planifiées très régulièrement. Dans l’idéal, au moins une fois par jour.

Suppression des travaux terminés et arrivé à échéance
export MAPPING_PATH=/apps/mapping/conf/mapping.conf 
/apps/mapping/bin/map_cron -date
Suppression des travaux non effectués (quel que soit leur statut), après 30 jours
export MAPPING_PATH=/apps/mapping/conf/mapping.conf 
/apps/mapping/bin/map_cron -cleanspool -relative_date:30/0/0.  # jour/mois/années
Suppression des fichiers de session web obsolètes

Fichiers context_menu.*, historique.*, et *.id du dossier /apps/mapping/temp

export MAPPING_PATH=/apps/mapping/conf/mapping.conf 
/apps/mapping/bin/map_cron -cleanid
Suppression des fichiers temporaires de conversion XPS et de Workflow

Ces fichiers se trouvent dans le dossier temporaire /apps/mapping/temp. Normalement, ils sont supprimés automatiquement. Mais en cas de problème (crash, interruption forcée…), ils peuvent subsister dans le dossier temp. Ce n’est donc pas une situation normale.

find /apps/mapping/temp -name "*cri.tmp"     -mtime +2 -exec rm -f {} \;
find /apps/mapping/temp -name "*ttf.tmp"     -mtime +2 -exec rm -f {} \;
find /apps/mapping/temp -name "compress_*"   -mtime +2 -exec rm -f {} \;
find /apps/mapping/temp -name "*.[0-9]"      -mtime +2 -exec rm -f {} \;
find /apps/mapping/temp -name "*.[0-9][0-9]" -mtime +2 -exec rm -f {} \;

Opérations de nettoyage et de rotations des logs

Pour des raisons pratiques, les commandes suivantes ne doivent pas être planifiées plus d’une fois par jour. Cela afin de ne pas multiplier les archives créées, et éviter de perdre des derniers jours de logs. La fréquence idéale est de 2 fois par semaine, par exemple le lundi soir et le jeudi soir, avant le déclenchement des batchs de nuit.

Archivage des logs

Cette commande permet de faire une conversion texte de tous les fichiers de logs, puis de les archiver dans un fichier zip horodaté.

export MAPPING_PATH=/apps/mapping/conf/mapping.conf 
/apps/mapping/bin/map_cron -cleanlog -folder:/apps/mapping/spool/logs -format:TXT

Résultat :

bash-4.2$ ls -lrt /apps/mapping/spool/logs/*.zip
-rw-r--r-- 1 mapadmin staff 254186924 30 oct.  /apps/mapping/spool/logs/2018_10_30_19_51.zip
-rw-r--r-- 1 mapadmin staff  58479965  7 nov.  /apps/mapping/spool/logs/2018_11_07_12_32.zip
Rotation des logs des sorties standard et erreur
mv  /apps/mapping/temp/stderr.txt  /apps/mapping/temp/stderr.txt.bak 
mv  /apps/mapping/temp/stdout.txt  /apps/mapping/temp/stdout.txt.bak
Suppression des archives de logs de plus de 30 jours
find /apps/mapping/spool/logs -name "*.zip" -mtime +30 -exec rm -f {} \;
Archivage des logs

Cette commande permet de faire une conversion texte de tous les fichiers de logs, puis de les archiver dans un fichier zip horodaté. export MAPPING_PATH=/apps/mapping/conf/mapping.conf

/apps/mapping/bin/map_cron -cleanlog -folder:/apps/mapping/spool/logs -format:TXT

Résultat :

bash-4.2$ ls -lrt /apps/mapping/spool/logs/*.zip
-rw-r--r-- 1 mapadmin staff 254186924 30 oct.  /apps/mapping/spool/logs/2018_10_30_19_51.zip
-rw-r--r-- 1 mapadmin staff  58479965  7 nov.  /apps/mapping/spool/logs/2018_11_07_12_32.zip
Rotation des logs des sorties standard et erreur
mv  /apps/mapping/temp/stderr.txt  /apps/mapping/temp/stderr.txt.bak 
mv  /apps/mapping/temp/stdout.txt  /apps/mapping/temp/stdout.txt.bak
Suppression des archives de logs de plus de 30 jours
find /apps/mapping/spool/logs -name "*.zip" -mtime +30 -exec rm -f {} \;