diff --git a/troubleshooting/capture.md b/troubleshooting/capture.md index ddd5f928e5bcec0f720340420cc69d4be66953c3..1756de21e5a4aedfee67315e65eaecc3e243ad6c 100644 --- a/troubleshooting/capture.md +++ b/troubleshooting/capture.md @@ -1,11 +1,9 @@ - -[capture](## capture) +[Vérifier la configuration de Maarchcapture](## Vérifier la configuration de Maarchcapture) [cas de courriers qui sont capturés mais qui n'arrivaient pas sur l'appli](## cas de courriers qui sont capturés mais qui n'arrivaient pas sur l'appli) -## capture - +## Vérifier la configuration de Maarchcapture ```xml @@ -19,56 +17,34 @@ root@MaarchCourrier:/opt/maarch/MaarchCapture/config# vi Capture.xml ``` - **Vérifier :** - -- directory (dans l'exemple ="/media/disk1/file_maarch_capture/") - -existe et a les bons droits et que les scans arrivent bien à cet emplacement +* Vérifier que le repértoire SCAN_MASS directory (dans l'exemple ="/media/disk1/file_maarch_capture/") existe et a les bons droits (droits d'ecriture par maarch et que les scans arrivent bien à cet emplacement -- ScanSource (dans l'exemple " /home/maarch/depot/mcc/maarchcourrier/") +* vérifier que document scanné arrivé bien au répertoire ScanSource (dans l'exemple " /home/maarch/depot/mcc/maarchcourrier/") -Que le document scanné arrivé bien à l'emplacement spécifié +* Vérifier que les chemins existent et disposent de suffisamment d'espace -/var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/scripts/CAPTURE.sh +## Vérifier le script Maarchcapture s'execute correcetement +Lancer le script avec le bon user soit comme ça : +``` ./var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/scripts/CAPTURE.sh ``` +ou comme ça ``` maarch@MaarchCourrier:/opt/maarch/MaarchCapture$ php MaarchCapture.php init -BatchName SCAN_MASS ``` -Vérifier que les chemins existent et disposent de suffisamment d'espace : - -```xml -nano ./config/Capture.xml -<batch name="MAARCH_SCAN_TO_MC_cs_olivet_1" directory="/opt/maarch/MaarchCapture/files/" id="{batchname}-{timestamp}-{rand}" lock="0"> - <workflow name="MAARCH_SCAN_TO_MC_cs_olivet_1" debug="true" logMode="Maarch" maarchLogParam="/var/www/html/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml" maarchLoggerName="loggerTechnique"> - <step name="ImportFiles" module='FileImport' function="ImportFiles"> - <input name="Directory">/opt/maarch/MaarchCapture/files/cs_olivet/</input> - <input name="Target">Document</input> - <input name="Action">none</input> - <input name="MoveDirectory">/opt/maarch/MaarchCapture/files/cs_olivet/backup/</input> - <input name="Recursive">0</input> - <input name="CreateFolders">0</input> - </step> - <step name="SendToMaarch" module="MaarchWSClient" function="processBatch"> - <input name="WS">cs_olivet</input> - <input name="Process">MaarchRestWSProcessFromScan</input> - <input name="CatchError">true</input> - <input name="configFile">MaarchWSClient_standard_sample.xml</input> - </step> - </workflow> -</batch> -``` +Ensuite consulter la log : ``` -maarch@MaarchCourrier: /opt/maarch/MaarchCapture/scripts/CAPTURE.sh +maarch@MaarchCourrier:/media/disk1/file_maarch_capture$ cat BSCAN_MASS-1563885961-1918389758/WSCAN_MASS-1563885961-1918389758.log ``` +## Vérifier le script Maarchcapture s'execute via la crontab -``` -maarch@MaarchCourrier:/opt/maarch/MaarchCapture$ php MaarchCapture.php init -BatchName SCAN_MASS -``` +Vérifier l'utilisateur qui execute le script et des droits du script correspondent ``` -maarch@MaarchCourrier:/media/disk1/file_maarch_capture$ cat BSCAN_MASS-1563885961-1918389758/WSCAN_MASS-1563885961-1918389758.log +root@SRVL-MAARCH:/etc/cron.d# cat MAARCH +#####capture des mails et des scans#### +* * * * * root /var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/scripts/CAPTURE.sh > /tmp/scans.txt +0 0 * * * root rm -Rf /var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/files/maarchcourrier/B* ``` - ## Test de connection ``` @@ -95,301 +71,9 @@ array(2) { -``` -root@SRVL-MAARCH:/var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/files/maarchcourrier/BCAPTURE_MAIL_1-1568018941-1571490931# cat MailCapture.log -2019-09-09 10:49:02 1 messages in mailbox -2019-09-09 10:49:02 Process message no 1 -2019-09-09 10:49:02 Parse structure parts (body/attachments)... -2019-09-09 10:49:02 End parse structure parts (body/attachments)... -2019-09-09 10:49:02 Message have 1 parts. -2019-09-09 10:49:02 Part 1/1 in progress ... -2019-09-09 10:49:02 SECTION => 1, CONTENT_TYPE => BODY, MIME_TYPE => html -2019-09-09 10:49:02 Disposition is BODY -2019-09-09 10:49:02 Document D1 added with source /var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/files/maarchcourrier/BCAPTURE_MAIL_1-1568018941-1571490931/MRXP264MB0662740B8CE8E03865A6B716F9B70@MRXP264MB0662.FRAP264.PROD.OUTLOOK.COM/1.html -2019-09-09 10:49:02 Moving message to INBOX/Maarch_sauvegarde... -``` -``` -root@SRVL-MAARCH:/var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/files/maarchcourrier/BCAPTURE_MAIL_1-1568018941-1571490931/MRXP264MB0662740B8CE8E03865A6B716F9B70@MRXP264MB0662.FRAP264.PROD.OUTLOOK.COM# cat Msg_parser.txt -stdClass Object -( - [date] => Mon, 9 Sep 2019 08:48:35 +0000 - [Date] => Mon, 9 Sep 2019 08:48:35 +0000 - [subject] => test maarch capture mail - [Subject] => test maarch capture mail - [message_id] => <MRXP264MB0662740B8CE8E03865A6B716F9B70@MRXP264MB0662.FRAP264.PROD.OUTLOOK.COM> - [toaddress] => Mairie <mairie@ville-gennevilliers.fr> - [to] => Array - ( - [0] => stdClass Object - ( - [personal] => Mairie - [mailbox] => mairie - [host] => ville-gennevilliers.fr - ) - - ) - - [fromaddress] => Mairie <mairie@ville-gennevilliers.fr> - [from] => Array - ( - [0] => stdClass Object - ( - [personal] => Mairie - [mailbox] => mairie - [host] => ville-gennevilliers.fr - ) - - ) - - [Recent] => N - [Unseen] => - [Flagged] => - [Answered] => - [Deleted] => - [Draft] => - [Msgno] => 1 - [MailDate] => 9-Sep-2019 10:48:36 +0200 - [Size] => 18270 - [udate] => 1568018916 - [uid] => 579 - [Msgid] => MRXP264MB0662740B8CE8E03865A6B716F9B70@MRXP264MB0662.FRAP264.PROD.OUTLOOK.COM - [MsgDirectory] => /var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/files/maarchcourrier/BCAPTURE_MAIL_1-1568018941-1571490931/MRXP264MB0662740B8CE8E03865A6B716F9B70@MRXP264MB0662.FRAP264.PROD.OUTLOOK.COM - [parts] => Array - ( - [0] => stdClass Object - ( - [type] => 0 - [encoding] => 4 - [ifsubtype] => 1 - [subtype] => html - [ifdescription] => 0 - [ifid] => 0 - [lines] => 14 - [bytes] => 367 - [ifdisposition] => 0 - [ifdparameters] => 0 - [ifparameters] => 1 - [parameters] => Array - ( - [0] => stdClass Object - ( - [attribute] => charset - [value] => iso-8859-1 - ) - - [charset] => iso-8859-1 - ) - - [section] => 1 - [typename] => text - [encodingname] => QPRINT - [mimetype] => text/html - [disposition] => BODY - [extension] => html - [filepath] => /var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/files/maarchcourrier/BCAPTURE_MAIL_1-1568018941-1571490931/MRXP264MB0662740B8CE8E03865A6B716F9B70@MRXP264MB0662.FRAP264.PROD.OUTLOOK.COM/1.html - [data] => <html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style> -</head> -<body dir="ltr"> -<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"> -<br> -</div> -</body> -</html> - - ) - - ) - - [parser] => Array - ( - [0] => stdClass Object - ( - [type] => 0 - [encoding] => 4 - [ifsubtype] => 1 - [subtype] => html - [ifdescription] => 0 - [ifid] => 0 - [lines] => 14 - [bytes] => 367 - [ifdisposition] => 0 - [ifdparameters] => 0 - [ifparameters] => 1 - [parameters] => Array - ( - [0] => stdClass Object - ( - [attribute] => charset - [value] => iso-8859-1 - ) - - [charset] => iso-8859-1 - ) - - [section] => 1 - [typename] => text - [encodingname] => QPRINT - [mimetype] => text/html - [disposition] => BODY - [extension] => html - [filepath] => /var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/files/maarchcourrier/BCAPTURE_MAIL_1-1568018941-1571490931/MRXP264MB0662740B8CE8E03865A6B716F9B70@MRXP264MB0662.FRAP264.PROD.OUTLOOK.COM/1.html - [data] => <html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style> -</head> -<body dir="ltr"> -<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"> -<br> -</div> -</body> -</html> - - ) - - ) - -) -``` -``` -root@SRVL-MAARCH:/var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/files/maarchcourrier/BCAPTURE_MAIL_1-1568018941-1571490931/MRXP264MB0662740B8CE8E03865A6B716F9B70@MRXP264MB0662.FRAP264.PROD.OUTLOOK.COM# - -root@SRVL-MAARCH:/var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/config# cat Capture.xml -<?xml version="1.0" encoding="UTF-8"?> -<capture> - <modules> - <module name="FileImport" src="modules/FileImport/FileImport.php" type="class"/> - <module name="PDFExtractor" src="modules/PDFExtractor/PDFExtractor.php" type="class"/> - <module name="PDFSpliter" src="modules/PDFSpliter/PDFSpliter.php" type="class"/> - <module name="Reader" src="modules/Reader/Reader.php" type="class"/> - <module name="Export" src="modules/Export/Export.php" type="class"/> - <module name="PDFAnalyzer" src="modules/PDFAnalyzer/PDFAnalyzer.php" type="class"/> - <module name="HTMLAnalyzer" src="modules/HTMLAnalyzer/HTMLAnalyzer.php" type="class"/> - <module name="MaarchWSClient" src="modules/MaarchWSClient/MaarchWSClient.php" type="class"/> - <module name="MailCapture" src="modules/MailCapture/MailCapture.php" type="class"/> - <module name="QRSeparator" src="modules/QRSeparator/MaarchQRSeparator.php" type="class"/> - </modules> - <batches> - <batch name="MAARCH_REST_WS" directory="/opt/maarch/MaarchCaptureGit/files/" lock="0" id="{batchname}-{timestamp}-{rand}"> - <workflow name="MAARCH_REST_WS" debug="true" logMode="Maarch" maarchLogParam="/var/www/html/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml" maarchLoggerName="loggerTechnique"> - <step name="ImportFiles" module='FileImport' function="ImportFiles"> - <input name="Directory">/opt/maarch/MaarchCaptureGit/files/TEST_IMPORT/</input> - <input name="Target">Document</input> - <input name="Action">none</input> - <input name="MoveDirectory">/opt/maarch/MaarchCaptureGit/files/TEST_IMPORT/backup/</input> - <input name="Recursive">0</input> - <input name="CreateFolders">0</input> - <step name="SendToMaarch" module="MaarchWSClient" function="processBatch"> - <input name="WS">MaarchRestWS</input> - <input name="Process">MaarchRestWSProcess</input> - <input name="CatchError">true</input> - </step> - <!-- <step name="SendToMaarch" module="MaarchWSClient" function="processBatch"> - <input name="WS">maarchcourrier</input> - <input name="Process">IMPORT_SCAN_BY_QRCODE</input> - <input name="CatchError">true</input> - </step> --> - </workflow> - </batch> - <batch directory="/var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/files/maarchcourrier" id="{batchname}-{timestamp}-{rand}" lock="0" name="SCAN_MASS"> - <workflow debug="true" logMode="Maarch" maarchLogParam="/var/www/html/maarch_courrier/custom/cs_maarch_db/apps/maarch_entreprise/xml/log4php.xml" maarchLoggerName="loggerTechnique" name="SCAN_MASS"> - <step function="separatePDF" module="QRSeparator" name="separatePDF"> - <input name="ScanSource">/opt/maarch/scans_courriers/</input> - </step> - <step function="processBatch" module="MaarchWSClient" name="SendToMaarch"> - <input name="WSDL">maarchcourrier</input> - <input name="Process">IMPORT_SCAN_BY_QRCODE</input> - <input name="CatchError">true</input> - <input name="configFile">MaarchWSClient.xml</input> - </step> - </workflow> - </batch> - <batch directory="/var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/files/maarchcourrier" id="{batchname}-{timestamp}-{rand}" lock="0" name="CAPTURE_MAIL_1"> - <workflow debug="true" logMode="Maarch" maarchLogParam="/var/www/html/maarch_courrier/custom/cs_maarch_db/apps/maarch_entreprise/xml/log4php.xml" maarchLoggerName="loggerTechnique" name="CAPTURE_MAIL_1"> - <step function="CaptureMails" module="MailCapture" name="CAPTURE_MAIL_1"> - <input name="account">account_1</input> - <input name="Action">move</input> - <input name="configFile">MailCapture.xml</input> - <input name="folder">INBOX/Maarch_sauvegarde</input> - </step> - <!-- Can be only used if form is extracted to the mail body --> - <!-- <step function="ExtractContactInfo" module="MailCapture" name="ExtractContactInfo"> - <input name="ContentPath">/Batch/Documents/Document</input> - </step> --> - <step function="processBatch" module="MaarchWSClient" name="SendToMaarch"> - <input name="WSDL">maarchcourrier</input> - <input name="Process"></input> - <input name="CatchError">false</input> - <input name="configFile">MaarchWSClient.xml</input> - </step> - <!-- Can be only used if a contact mail is extracted from the mail --> - <!-- <step name="NotifyContact" module='MailCapture' function="notifyContact"> - <input name="ContentPath">/Batch/Documents/Document</input> - </step> --> - </workflow> - </batch> - <batch directory="/var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/files/maarchcourrier" id="{batchname}-{timestamp}-{rand}" lock="0" name="CAPTURE_MAIL_2"> - <workflow debug="true" logMode="Maarch" maarchLogParam="/var/www/html/maarch_courrier/custom/cs_maarch_db/apps/maarch_entreprise/xml/log4php.xml" maarchLoggerName="loggerTechnique" name="CAPTURE_MAIL_2"> - <step function="CaptureMails" module="MailCapture" name="CAPTURE_MAIL_2"> - <input name="account">account_2</input> - <input name="Action">move</input> - <input name="configFile">MailCapture.xml</input> - <input name="folder">INBOX/Maarch_sauvegarde</input> - </step> - <!-- Can be only used if form is extracted to the mail body --> - <!-- <step function="ExtractContactInfo" module="MailCapture" name="ExtractContactInfo"> - <input name="ContentPath">/Batch/Documents/Document</input> - </step> --> - <step function="processBatch" module="MaarchWSClient" name="SendToMaarch"> - <input name="WSDL">maarchcourrier</input> - <input name="Process">IMPORT_MAIL_1</input> - <input name="CatchError">false</input> - <input name="configFile">MaarchWSClient.xml</input> - </step> - <!-- Can be only used if a contact mail is extracted from the mail --> - <!-- <step name="NotifyContact" module='MailCapture' function="notifyContact"> - <input name="ContentPath">/Batch/Documents/Document</input> - </step> --> - </workflow> - </batch> - <batch directory="/var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/files/maarchcourrier" id="{batchname}-{timestamp}-{rand}" lock="0" name="SCAN_SIGN"> - <workflow debug="true" logMode="Maarch" maarchLogParam="/var/www/html/maarch_courrier/custom/cs_maarch_db/apps/maarch_entreprise/xml/log4php.xml" maarchLoggerName="loggerTechnique" name="SCAN_SIGN"> - <step function="separatePDF" module="QRSeparator" name="separatePDF"> - <input name="ScanSource">/opt/maarch/scans_signers/</input> - </step> - <step function="processBatch" module="MaarchWSClient" name="SendToMaarch"> - <input name="WSDL">MaarchRestWS</input> - <input name="Process">IMPORT_SCAN_BY_QRCODE_SIGN</input> -<!-- <input name="Action">move</input> - <input name="MoveDirectory">/opt/maarch/scans_signers/backup/</input> ---> <input name="CatchError">true</input> - <input name="configFile">MaarchWSClient.xml</input> - </step> - </workflow> - </batch> - </batches> -</capture> -``` -``` -root@SRVL-MAARCH:/etc/cron.d# cat MAARCH -#####capture des mails et des scans#### -* * * * * root /var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/scripts/CAPTURE.sh > /tmp/scans.txt -0 0 * * * root rm -Rf /var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/files/maarchcourrier/B* -root@SRVL-MAARCH:/etc/cron.d# vi MAARCH -root@SRVL-MAARCH:/etc/cron.d# cat MAARCH -#####capture des mails et des scans#### -#* * * * * root /var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/scripts/CAPTURE.sh > /tmp/scans.txt -#0 0 * * * root rm -Rf /var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/files/maarchcourrier/B* -``` - - - ``` -maarch_db=# select alt_identifier from mlb_coll_ext where dest_user_id='mairie@ville-gennevilliers.fr'; +maarch_db=# select alt_identifier from mlb_coll_ext where dest_user_id='mairie@villemaarchlesbains.fr'; ``` ## cas de courriers qui sont capturés mais qui n'arrivaient pas sur l'appli