IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Administration système Discussion :

Schedule de systemctl


Sujet :

Administration système

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre actif
    Homme Profil pro
    Inscrit en
    Janvier 2009
    Messages
    97
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2009
    Messages : 97
    Par défaut Schedule de systemctl
    Bonjour,

    J'ai une question concernant systemctl, j'ai mis en place un script de stop/start de certains services propre à mon exploitation, à chaque reboot de serveur les services se lance automatiquement/
    Ma question est la suivante: " est-il possible de scheduler plusieurs systemctl afin de lancer les relance de services les uns apres les autres car certains services ne doivent pas se lancer en meme temps ? "


    Merci de vos réponses

    Bonne journée

  2. #2
    Membre Expert
    Avatar de transgohan
    Homme Profil pro
    Développeur Temps réel Embarqué
    Inscrit en
    Janvier 2011
    Messages
    3 149
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Maine et Loire (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur Temps réel Embarqué

    Informations forums :
    Inscription : Janvier 2011
    Messages : 3 149
    Par défaut
    Euh non on va pas lancer plusieurs gestionnaires de service ça risque de mettre la grouille partout !

    Par contre tu peux indiquer à systemctl de lancer certains services après d'autres avec la configuration "After".

    Extrait du man :
    Before=, After=

    These two settings expect a space-separated list of unit names. They configure ordering dependencies between units. If a unit foo.service contains a setting Before=bar.service and both units are being started, bar.service's start-up is delayed until foo.service has finished starting up. Note that this setting is independent of and orthogonal to the requirement dependencies as configured by Requires=, Wants= or BindsTo=. It is a common pattern to include a unit name in both the After= and Requires= options, in which case the unit listed will be started before the unit that is configured with these options. This option may be specified more than once, in which case ordering dependencies for all listed names are created. After= is the inverse of Before=, i.e. while After= ensures that the configured unit is started after the listed unit finished starting up, Before= ensures the opposite, that the configured unit is fully started up before the listed unit is started. Note that when two units with an ordering dependency between them are shut down, the inverse of the start-up order is applied. i.e. if a unit is configured with After= on another unit, the former is stopped before the latter if both are shut down. Given two units with any ordering dependency between them, if one unit is shut down and the other is started up, the shutdown is ordered before the start-up. It doesn't matter if the ordering dependency is After= or Before=, in this case. It also doesn't matter which of the two is shut down, as long as one is shut down and the other is started up. The shutdown is ordered before the start-up in all cases. If two units have no ordering dependencies between them, they are shut down or started up simultaneously, and no ordering takes place. It depends on the unit type when precisely a unit has finished starting up. Most importantly, for service units start-up is considered completed for the purpose of Before=/After= when all its configured start-up commands have been invoked and they either failed or reported start-up success.

  3. #3
    Membre actif
    Homme Profil pro
    Inscrit en
    Janvier 2009
    Messages
    97
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2009
    Messages : 97
    Par défaut
    en fait j'ai ca dans mon fichier service en ce moment

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
     
    [Unit]
    Description=Start/Stop host application
    Requires=network.target
    After=local-fs.target network.target
     
    [Service]
    Type=oneshot
    ExecStop=/apps/scope/scripts/stopAtBoot.sh
    RemainAfterExit=yes
    ExecStart=/apps/scope/scripts/startAtBoot.sh
    User=unix
    Group=prod
     
    [Install]
    WantedBy=multi-user.target
    le scripts stopAtboot stop des services a chaque reboot du serveur puis ensuite le startAtboot les relance jusqu'ici rien de tres technique lol
    Mais j'aimerai savoir si je peux rajouter apres mon start une nouvelle ligne pour faire appeler de nouveau deux scripts de stop start , ci-dessous le script voulu, cela te semblerai bon ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
     
    [Unit]
    Description=Start/Stop host application
    Requires=network.target
    After=local-fs.target network.target
     
    [Service]
    Type=oneshot
    ExecStop=/apps/scope/scripts/stopAtBoot.sh
    RemainAfterExit=yes
    ExecStart=/apps/scope/scripts/startAtBoot.sh
    User=unix
    Group=prodExecStop=/apps/scope/scripts/stopAtunixBoot.sh
    RemainAfterExit=yes
    ExecStart=/apps/scope/scripts/startAtunixBoot.sh
    User=test
    Group=prod
     
    [Install]
    WantedBy=multi-user.target

    Merci de vos réponses

  4. #4
    Membre Expert
    Avatar de transgohan
    Homme Profil pro
    Développeur Temps réel Embarqué
    Inscrit en
    Janvier 2011
    Messages
    3 149
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Maine et Loire (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur Temps réel Embarqué

    Informations forums :
    Inscription : Janvier 2011
    Messages : 3 149
    Par défaut
    J'ai pas trop compris l'utilité de tout ça.
    Pourquoi ne pas faire un script sh qui appelle tous les scripts les uns derrière les autres ?

  5. #5
    Membre actif
    Homme Profil pro
    Inscrit en
    Janvier 2009
    Messages
    97
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Janvier 2009
    Messages : 97
    Par défaut
    car il faut que cela s'enchaine ,

    En premier le stopAtboot puis à la fin de se script le startboot s'enchaine
    puis ensuite le stopAtunixBoot et a la fin de celui ci le startAtunixBoot

    mais il y a une particularité, les deux premiers scripts se lancent avec le user unix et les deux suivants avec le user test

    je peux faire quelque chose comme ci-dessous d'apres toi?



    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
     
    [Unit]
    Description=Start/Stop host application
    Requires=network.target
    After=local-fs.target network.target
     
    [Service]
    Type=oneshot
    ExecStop=/apps/scope/scripts/stopAtBoot.sh
    RemainAfterExit=yes
    ExecStart=/apps/scope/scripts/startAtBoot.sh
    User=unix
    Group=prod
    Group=prodExecStop=/apps/scope/scripts/stopAtunixBoot.sh
    RemainAfterExit=yes
    ExecStart=/apps/scope/scripts/startAtunixBoot.sh
    User=test
    Group=prod
     
     
    [Install]
    WantedBy=multi-user.target

  6. #6
    Membre Expert
    Avatar de transgohan
    Homme Profil pro
    Développeur Temps réel Embarqué
    Inscrit en
    Janvier 2011
    Messages
    3 149
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Maine et Loire (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur Temps réel Embarqué

    Informations forums :
    Inscription : Janvier 2011
    Messages : 3 149
    Par défaut
    Et pourquoi ne pas faire un second service (test) qui attendra le démarrage du premier (unix) ?

Discussions similaires

  1. scheduler mysql
    Par Alextk dans le forum Administration
    Réponses: 7
    Dernier message: 18/05/2006, 15h43
  2. Quartz: impossible d'instancier le scheduler!
    Par lOurs4816 dans le forum API standards et tierces
    Réponses: 28
    Dernier message: 20/04/2006, 17h11
  3. [Stratégie][scheduler] Ecouter un répertoire
    Par FenderStrato dans le forum Général Java
    Réponses: 10
    Dernier message: 08/03/2006, 13h43
  4. Scheduled Task
    Par wiglaft dans le forum API, COM et SDKs
    Réponses: 1
    Dernier message: 22/12/2005, 04h49
  5. DTS package scheduling problems
    Par jhaythem dans le forum MS SQL Server
    Réponses: 5
    Dernier message: 10/08/2005, 13h22

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo