Créer un daemon Linux pour Squash TM
Créer un daemon Linux pour Squash TM
Bonjour,
Nous avons installé Squash TM 1.20.0 à l'aide de l'archive tar.gz sur une machine CentOS 7 non connectée à internet.
Nous parvenons à démarrer Squash TM manuellement grâce à la commande ./startup.sh &
Cependant, nous souhaiterions pouvoir créer un daemon (service) Linux pour que le démarrage/redémarrage de Squash TM soit automatique.
Comment faut-il procéder?
Est-il par exemple possible de créer un service (Daemon) avec l’utilitaire chkconfig? Nous ne voyons pas dans le fichier startup.sh un en-tête pouvant définir qu’il s’agit d’un script compatible chkconfig du style indiqué en PJ.
Dans l’attente d’un retour, merci pour votre aide précieuse.
Nous avons installé Squash TM 1.20.0 à l'aide de l'archive tar.gz sur une machine CentOS 7 non connectée à internet.
Nous parvenons à démarrer Squash TM manuellement grâce à la commande ./startup.sh &
Cependant, nous souhaiterions pouvoir créer un daemon (service) Linux pour que le démarrage/redémarrage de Squash TM soit automatique.
Comment faut-il procéder?
Est-il par exemple possible de créer un service (Daemon) avec l’utilitaire chkconfig? Nous ne voyons pas dans le fichier startup.sh un en-tête pouvant définir qu’il s’agit d’un script compatible chkconfig du style indiqué en PJ.
Dans l’attente d’un retour, merci pour votre aide précieuse.
- Pièces jointes
-
- PJ.txt
- (905 octets) Téléchargé 177 fois
Re: Créer un daemon Linux pour Squash TM
Bonjour,
Quelqu'un pour m'aider? Même un petit début de piste me conviendrait
Merci!
Quelqu'un pour m'aider? Même un petit début de piste me conviendrait
Merci!
Re: Créer un daemon Linux pour Squash TM
Bonjour,
je relance, on ne sais jamais!
Merci d'avance pour toutes vos pistes ou solutions.
je relance, on ne sais jamais!
Merci d'avance pour toutes vos pistes ou solutions.
Re: Créer un daemon Linux pour Squash TM
Bonjour,
Voici un script systemd. Pas besoin de passer par chkconfig.
Le contenu au format est à placer dans un fichier nommé squash-tm.service dans /usr/lib/systemd/system sur CentoS/RedHat
Il faut éditer les 2 lignes avec le chemin vers le répertoire d'installation de squash.
Puis exécutez les commandes suivantes:
Voici un script systemd. Pas besoin de passer par chkconfig.
Le contenu au format
Code : Tout sélectionner
code
Il faut éditer les 2 lignes avec le chemin vers le répertoire d'installation de squash.
Code : Tout sélectionner
[Unit]
Description=Squash-tm daemon
After=systemd-user-sessions.service time-sync.target
[Service]
WorkingDirectory=/chemin/vers/squash-tm/bin
ExecStart=/chemin/vers/squash-tm/bin/startup.sh
ExecStop=/bin/kill $MAINPID
KillMode=process
Type=simple
[Install]
WantedBy=multi-user.target
Code : Tout sélectionner
systemctl daemon-reload
systemctl enable squash-tm.service
et
systemctl start squash-tm.service
Re: Créer un daemon Linux pour Squash TM
For running v2.1.0 as a Service under Ubuntu 20.04 LTS I followed the description.
Two comments/deviation I have (don't know if that matters to anyone else but just want to meniton.)
From the install guide:
1. With the downloaded package (tar.gz) there was no file squash-tm.service to copy. I had to create it anew in /ets/systemd/system.
After daemon-reload, squash-tm enable and trying to start squash-tm there was no success.
Logs pointed me to an issue with the user-settings.
Therefor my second point is this (again from install guide) find the 'User=' and 'Group=' in the suggested squash-tm.service file:
... and comment them out to be like this:
After this daemon-reload, squash-tm enable and start squash-tm worked like a charm.
As stated in another thread; I am not a programmer nor any kind of professional.
So if I did sth. very wrong... feel free and encouraged to correct me!
A further adaption I made is to separate the logs from the system log.
At the end of the [Service] block in the squash-tm.service file I added two more lines...
But it is not neccessary to let squash-tm run as a service. It ist easier to find relevant log-entries to have them separated. IMHO
Two comments/deviation I have (don't know if that matters to anyone else but just want to meniton.)
From the install guide:
Code : Tout sélectionner
cp /opt/squash-tm/squash-tm.service /etc/systemd/system/
After daemon-reload, squash-tm enable and trying to start squash-tm there was no success.
Logs pointed me to an issue with the user-settings.
Therefor my second point is this (again from install guide) find the 'User=' and 'Group=' in the suggested squash-tm.service file:
Code : Tout sélectionner
[Service]
WorkingDirectory=/opt/squash-tm/bin
ExecStart=/opt/squash-tm/bin/startup.sh
ExecStop=/bin/kill $MAINPID
KillMode=process
Type=simple
User=squash-tm
Group=squash-tm
Restart=on-failure
RestartSec=10
StartLimitInterval=120
StartLimitBurst=3
Code : Tout sélectionner
...
# User=squash-tm
# Group=squash-tm
...
After this daemon-reload, squash-tm enable and start squash-tm worked like a charm.
As stated in another thread; I am not a programmer nor any kind of professional.
So if I did sth. very wrong... feel free and encouraged to correct me!
A further adaption I made is to separate the logs from the system log.
At the end of the [Service] block in the squash-tm.service file I added two more lines...
Code : Tout sélectionner
[Service]
...
StandardOutput=append:/var/log/squash-tm.log
StandardError=append:/var/log/squash-tm-error.log