From 3dfec525d1096f7982ae6885ed065c0df7eecd65 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Mon, 13 Jun 2016 15:51:42 +0200 Subject: [PATCH 1/5] Ajout de l'aide SFTP --- README-SFTP-USE | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 README-SFTP-USE diff --git a/README-SFTP-USE b/README-SFTP-USE new file mode 100644 index 0000000..1f60933 --- /dev/null +++ b/README-SFTP-USE @@ -0,0 +1,17 @@ +Définition des dossiers +======================= +send : Client => SD +recv : SD => Client + +Création d'un utilisateur +========================= + +useradd -s /bin/false -g sftp -d /home/data/sftp/username username +passwd username + +Création du HOME +================ +mkdir -p /home/data/sftp/username/{recv,send} +chown username:sftp -R /home/data/sftp/username +chmod -Rv 755 /home/data/sftp/username/ +chown root:root /home/data/sftp/username \ No newline at end of file From 202de1c7a5bcc75b76bfca385dee6109a3dca1fb Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Mon, 13 Jun 2016 15:51:52 +0200 Subject: [PATCH 2/5] Ajout de l'aide FTP --- README-FTP-USE | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 README-FTP-USE diff --git a/README-FTP-USE b/README-FTP-USE new file mode 100644 index 0000000..18c975e --- /dev/null +++ b/README-FTP-USE @@ -0,0 +1,23 @@ +Définition des dossiers +======================= +send : Client => SD +recv : SD => Client + +Création d'un utilisateur +========================= +pure-pw useradd [user] -u ftpuser -j -d [dir] + +Modifier le mot de passe +======================== +pure-pw passwd [user] + +Modifier un utilisateur +======================= +pure-pw usermod [user] -d [newdir] + +Supprimer un utilisateur +======================== +pure-pw userdel [user] + + +Note : Après chaque modification : pure-pw mkdb \ No newline at end of file From f26f913a6af17a84819c12f7c93a4cd540c25cad Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Mon, 13 Jun 2016 15:56:41 +0200 Subject: [PATCH 3/5] Ajout EFFICO --- fileConfig.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fileConfig.php b/fileConfig.php index 3aa0cb0..38d31f3 100644 --- a/fileConfig.php +++ b/fileConfig.php @@ -138,4 +138,14 @@ return array( ), ), ), + 'effico' => array( + 'prestations' => array( + array( + 'name' => 'DIFBODPRDSFTPEFFICO', + 'type' => 'SFTP', + 'in' => array(), + 'out' => array(), + ), + ), + ), ); From 970da03f7925f49282c0c7fef1d2ddf3b315971e Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Thu, 16 Jun 2016 10:15:32 +0200 Subject: [PATCH 4/5] Configuration SOFID --- fileConfig.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fileConfig.php b/fileConfig.php index 38d31f3..930adbc 100644 --- a/fileConfig.php +++ b/fileConfig.php @@ -148,4 +148,17 @@ return array( ), ), ), + 'sofid' => array( + 'prestations' => array( + array( + 'name' => 'SURBODPRDFTSSOFID', + 'type' => 'FTP', + 'in' => array( + 'Route' => array( 'cp' => '/home/data/clients-ftp/sofid/send' ), + 'CopyDeleteAfter' => true, + ), + 'out' => array(), + ), + ), + ), ); From 99859bb39bf2862ff8ab0c2f2f7f792019520b2d Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Fri, 17 Jun 2016 11:08:25 +0200 Subject: [PATCH 5/5] Renommage des fichiers --- fileClean.php => clean.php | 0 fileConfig.php => config.php | 0 fileRead.php => read.php | 2 +- fileRecv.php => recv.php | 2 +- scripts/build/configure.php | 58 ------------------- scripts/build/etc/cron.d/flux | 4 +- scripts/build/incron.php | 6 +- .../build/profil/prod-celeste/application.ini | 43 -------------- fileSend.php => send.php | 4 +- fileTck.php => tck.php | 2 +- trigger.php | 8 +-- 11 files changed, 14 insertions(+), 115 deletions(-) rename fileClean.php => clean.php (100%) rename fileConfig.php => config.php (100%) rename fileRead.php => read.php (99%) rename fileRecv.php => recv.php (99%) delete mode 100644 scripts/build/configure.php delete mode 100644 scripts/build/profil/prod-celeste/application.ini rename fileSend.php => send.php (98%) rename fileTck.php => tck.php (98%) diff --git a/fileClean.php b/clean.php similarity index 100% rename from fileClean.php rename to clean.php diff --git a/fileConfig.php b/config.php similarity index 100% rename from fileConfig.php rename to config.php diff --git a/fileRead.php b/read.php similarity index 99% rename from fileRead.php rename to read.php index 4b0ff3b..638827e 100644 --- a/fileRead.php +++ b/read.php @@ -73,7 +73,7 @@ if ( isset($opts->file) ) $fluxRepository = str_replace(array($fluxBasePath.'/', '/'.$filenameIn), array('', ''), $opts->file); // --- Match prestation - $prestations = include __DIR__ . '/fileConfig.php'; + $prestations = include __DIR__ . '/config.php'; $prestation = null; if (array_key_exists($client, $prestations)) { diff --git a/fileRecv.php b/recv.php similarity index 99% rename from fileRecv.php rename to recv.php index 202f6fc..d5742fd 100644 --- a/fileRecv.php +++ b/recv.php @@ -98,7 +98,7 @@ if ( $result->count() > 0 ) { $optionsLog = false; // Match prestation - $prestations = include __DIR__ . '/fileConfig.php'; + $prestations = include __DIR__ . '/config.php'; $prestation = null; if (array_key_exists($item->client, $prestations)) { diff --git a/scripts/build/configure.php b/scripts/build/configure.php deleted file mode 100644 index 318f949..0000000 --- a/scripts/build/configure.php +++ /dev/null @@ -1,58 +0,0 @@ - "Display usage information.", - 'install=s' => "Make install operation.", - ) - ); - $opts->parse(); -} catch (Zend_Console_Getopt_Exception $e) { - echo $e->getUsageMessage(); - exit; -} - -//Usage -if (isset($opts->help)) -{ - echo $opts->getUsageMessage(); - exit; -} - - -if ( ! empty($opts->install) ) -{ - echo date('Y-m-d H:i:s')." - Démarrage de la configuration.\n"; - - //Copy configuration - $configDir = realpath(dirname(__FILE__)).'/profil'; - $appconfigDir = APPLICATION_PATH.'/configs'; - $profil = $opts->install; - - if ( !file_exists( $appconfigDir.'/application.ini') ) { - $result = copy($configDir.'/'.$profil.'/application.ini', $appconfigDir.'/application.ini'); - if ($result !== true) { - echo date('Y-m-d H:i:s')." - Impossible de copier la configuration.\n"; - exit(1); - } - } else { - echo date('Y-m-d H:i:s')." - Le profil de configuration existe déja.\n"; - exit(1); - } - - echo date('Y-m-d H:i:s')." - Fin de la configuration.\n"; -} else { - echo date('Y-m-d H:i:s')." - Je n'ai rien fait !\n"; -} diff --git a/scripts/build/etc/cron.d/flux b/scripts/build/etc/cron.d/flux index 7c27e8e..f760aee 100644 --- a/scripts/build/etc/cron.d/flux +++ b/scripts/build/etc/cron.d/flux @@ -1,6 +1,6 @@ # Gestion des flux a envoyer au client -*/15 4-18 * * * root php /home/flux/fileRecv.php --cron >> /home/log/recv.log 2>&1 +*/15 4-18 * * * root php /home/flux/current/recv.php --cron >> /home/log/recv.log 2>&1 # Nettoyage -01 18 * * * root php /home/flux/fileClean.php --cron >> /home/log/clean.log 2>&1 \ No newline at end of file +01 18 * * * root php /home/flux/current/clean.php --cron >> /home/log/clean.log 2>&1 \ No newline at end of file diff --git a/scripts/build/incron.php b/scripts/build/incron.php index 6dc6285..0a54aa8 100644 --- a/scripts/build/incron.php +++ b/scripts/build/incron.php @@ -38,7 +38,7 @@ if(isset($opts->help)) exit; } -$prestations = include APPLICATION_PATH . '/../fileConfig.php'; +$prestations = include APPLICATION_PATH . '/../config.php'; if ($opts->list) { @@ -83,7 +83,7 @@ if ($opts->generate) } $fluxBasePath = '/home/data/' . strtolower($item['type']) . '/' . $client . '/' . $directory; $file = __DIR__ . '/incron.d/' . strtolower($item['type']) . '_' . $client; - file_put_contents($file, "$fluxBasePath IN_CLOSE_WRITE php /home/batchFlux/fileSend.php --file $@/$# >> /home/log/send.log 2>&1"); + file_put_contents($file, "$fluxBasePath IN_CLOSE_WRITE php /home/flux/current/send.php --file $@/$# >> /home/log/send.log 2>&1"); echo "File created $file\n"; } } @@ -109,7 +109,7 @@ if ($opts->generate) } $fluxBasePath = '/home/data/' . strtolower($item['type']) . '/' . $client. '/' . $directory; $file = __DIR__ . '/incron.d/' . strtolower($item['type']) . '_' . $client . '_recv'; - file_put_contents($file, "$fluxBasePath IN_ACCESS php /home/batchFlux/fileRead.php --file $@/$# >> /home/log/read.log 2>&1"); + file_put_contents($file, "$fluxBasePath IN_ACCESS php /home/flux/current/read.php --file $@/$# >> /home/log/read.log 2>&1"); echo "File created $file\n"; } } diff --git a/scripts/build/profil/prod-celeste/application.ini b/scripts/build/profil/prod-celeste/application.ini deleted file mode 100644 index 20234b4..0000000 --- a/scripts/build/profil/prod-celeste/application.ini +++ /dev/null @@ -1,43 +0,0 @@ -[production] -phpSettings.date.timezone = "Europe/Paris" -phpSettings.display_startup_errors = 0 -phpSettings.display_errors = 0 -bootstrap.path = APPLICATION_PATH "/Bootstrap.php" -bootstrap.class = "Bootstrap" -appnamespace = "Application" -resources.frontController.params.displayExceptions = 0 -resources.layout.layout = "main" -resources.layout.layoutPath = APPLICATION_PATH "/views" -resources.view.basePath = APPLICATION_PATH "/views" -autoloaderNamespaces[] = "Application_" -autoloaderNamespaces[] = "Scores_" -autoloaderNamespaces[] = "Metier_" - -; Scores configuration -profil.path.data = "/home/data" -profil.path.storage = "/home/data/clients" -profil.path.ftp = "/home/data/ftp" -profil.path.sftp = "/home/data/sftp" - -; Database configuration -profil.db.metier.adapter=mysqli -profil.db.metier.params.host=192.168.3.28 -profil.db.metier.params.username=batchuser -profil.db.metier.params.password=2XQTpKatBVRezXE9 -profil.db.metier.params.dbname=sdv1 -profil.db.metier.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8" - -; Mail configuration -profil.db.method = sendmail - -[staging : production] -resources.frontController.params.displayExceptions = 1 - -[development : production] -phpSettings.display_startup_errors = 1 -phpSettings.display_errors = 1 -resources.frontController.params.displayExceptions = 1 - -[testing : production] -phpSettings.display_startup_errors = 1 -phpSettings.display_errors = 1 \ No newline at end of file diff --git a/fileSend.php b/send.php similarity index 98% rename from fileSend.php rename to send.php index 0695561..8b7b84b 100644 --- a/fileSend.php +++ b/send.php @@ -64,7 +64,7 @@ if ( isset($opts->file) ) } // --- Don't play with *.tck files if ($extension == 'tck') { - passthru(__DIR__ . '/fileTck.php --file '.$opts->file.' >> /home/log/tck.log 2>&1'); + passthru(__DIR__ . '/tck.php --file '.$opts->file.' >> /home/log/tck.log 2>&1'); exit; } $client = basename(dirname($pathParts['dirname'])); @@ -82,7 +82,7 @@ if ( isset($opts->file) ) $fluxRepository = str_replace(array($fluxBasePath.'/', '/'.$filenameIn), array('', ''), $opts->file); // --- Match prestation - $prestations = include __DIR__ . '/fileConfig.php'; + $prestations = include __DIR__ . '/config.php'; $prestation = null; if (array_key_exists($client, $prestations)) { $clientPrestations = $prestations[$client]['prestations']; diff --git a/fileTck.php b/tck.php similarity index 98% rename from fileTck.php rename to tck.php index 1dbc2dd..a904442 100644 --- a/fileTck.php +++ b/tck.php @@ -81,7 +81,7 @@ if ( isset($opts->file) ) $fluxRepository = str_replace(array($fluxBasePath.'/', '/'.$filenameIn), array('', ''), $opts->file); // --- Match prestation - $prestations = include __DIR__ . '/fileConfig.php'; + $prestations = include __DIR__ . '/config.php'; $prestation = null; if (array_key_exists($client, $prestations)) { diff --git a/trigger.php b/trigger.php index 653fecc..6f00e4d 100644 --- a/trigger.php +++ b/trigger.php @@ -47,16 +47,16 @@ switch($opts->event) { case 'IN_CLOSE_WRITE': if ($extension == 'tck') { - passthru(__DIR__ . '/fileTck.php --file '.$opts->file.' >> /home/log/tck.log 2>&1'); + passthru(__DIR__ . '/tck.php --file '.$opts->file.' >> /home/log/tck.log 2>&1'); } else { - passthru(__DIR__ . '/fileSend.php --file '.$opts->file.' >> /home/log/send.log 2>&1'); + passthru(__DIR__ . '/send.php --file '.$opts->file.' >> /home/log/send.log 2>&1'); } break; case 'IN_ACCESS': case 'IN_CLOSE_NOWRITE': - passthru(__DIR__ . '/fileRead.php --file '.$opts->file.' >> /home/log/read.log 2>&1'); + passthru(__DIR__ . '/read.php --file '.$opts->file.' >> /home/log/read.log 2>&1'); break; case 'IN_DELETE': - passthru(__DIR__ . '/fileRead.php --file '.$opts->file.' >> /home/log/read.log 2>&1'); + passthru(__DIR__ . '/read.php --file '.$opts->file.' >> /home/log/read.log 2>&1'); break; }