Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 07/06/2017, à 19:31

Vista

Etherpad - creation d'un service dans ubuntu16-04

Bonjour

je me suis installé un ubuntu 16.04 et j'ai aussi installer l'appli etherpad, qui fonctionne trés bien mais je suis obliger de laisser ma fenetre de terminal ouvert pour démmarer l'application j'ai donc essayer de créer un service mais ça ne fonctionne pas
voici les manipulations que j'ai réaliser qu'en pensez vous svp :

Commande qui me permet de lancer l'application :

`sudo /opt/etherpad/etherpad-lite/bin/run.sh --root`

mais si je ferme cette fenetre etherpad n'est plus disponible
je cherche donc à créer un service comme le propose le tuto ubuntu :

`sudo nano /etc/systemd/etherpad-lite.service`

```

[Unit]
Description=Etherpad-lite, the collaborative editor.
After=syslog.target network.target

[Service]
Type=simple
User=etherpad
Group=etherpad
WorkingDirectory=/opt/etherpad
ExecStart=/usr/bin/nodejs /opt/etherpad/etherpad-lite/node_modules/ep_etherpad-lite/node/server.js
Restart=always

[Install]
WantedBy=multi-user.target

```

Deuxième fichier :

`sudo nano /etc/init.d/etherpad-lite

`

```

#!/bin/sh
### BEGIN INIT INFO
# Provides: etherpad-lite
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts etherpad lite
# Description: starts etherpad lite using start-stop-daemon
### END INIT INFO
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin"
LOGFILE="/var/log/etherpad-lite/etherpad-lite.log"
EPLITE_DIR="/opt/etherpad/etherpad-lite/"
EPLITE_BIN="bin/run.sh"
USER="root"
GROUP="root"
DESC="Etherpad Lite"
NAME="etherpad-lite"
set -e
. /lib/lsb/init-functions
start() {
echo "Starting $DESC... "
start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile /var/run/$NAME.pid --exec "$EPLITE_DIR/$EPLITE_BIN" -- $LOGFILE || true
echo "done"
}
# Nous avons besoin de cette fonction pour assurer la totalité du processus lorsqu'il sera tué
killtree() {
local _pid=$1
local _sig=${2-TERM}
for _child in $(ps -o pid --no-headers --ppid ${_pid}); do
killtree ${_child} ${_sig}
done
kill -${_sig} ${_pid}
}
stop() {
echo "Stopping $DESC... "
while test -d /proc/$(cat /var/run/$NAME.pid); do
killtree $(cat /var/run/$NAME.pid) 15
sleep 0.5
done
rm /var/run/$NAME.pid
echo "done"
}
status() {
status_of_proc -p /var/run/$NAME.pid "" "etherpad-lite" && exit 0 || exit $?
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $NAME {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0
```


et donc quand je démmare mon service j'ai l'erreur suivante :


` sudo /etc/init.d/etherpad-lite start
[....] Starting etherpad-lite (via systemctl): etherpad-lite.serviceFailed to start etherpad-lite.service: Unit etherpad-lite.service not found.
 failed!
`

quand pensez vous svp ?

merci

Dernière modification par Vista (Le 07/06/2017, à 19:31)

Hors ligne

#2 Le 08/06/2017, à 10:14

bruno

Re : Etherpad - creation d'un service dans ubuntu16-04

Bonjour,

Le deuxième fichier ne sert a priori à rien : soit tu utilises un fichier de service systemd, soit tu utilises un script d'init, mais pas les deux…

Le fichier de service doit être dans /etc/systemd/system/ (et non directement dans /etc/systemd).

Un fois ce fichier placé au bon endroit, tu lances le service avec :

sudo systemctl start etherpad-lite

Dernière modification par bruno (Le 08/06/2017, à 10:14)

Hors ligne

#3 Le 16/03/2018, à 19:05

kholo

Re : Etherpad - creation d'un service dans ubuntu16-04

salut,
je reprends ce fil pour une installation sur 16.04
mélange de la doc et de tutos pour debian
A valider sur une installation fraîche !

la doc
installation et dépendances

sudo apt install nodejs-legacy npm git curl

création de l'utilisateur et du dossier associé

sudo adduser --system --home=/srv/etherpad-lite --group etherpad-lite
cd /srv

Chargez y un clone du logiciel Etherpad Lite à l'aide de Git :

sudo git clone 'git://github.com/ether/etherpad-lite.git'

Ceci fait, allez dans le répertoire /srv/etherpad-lite/bin

cd /srv/etherpad-lite/bin

Puis lancez l'installation d'Etherpad Lite à l'aide d'un script adapté :

sudo ./installDeps.sh

pour lancer le service à la main

sudo /srv/etherpad-lite/bin/run.sh --root

puis rendez vous sur la page
localhost:9001
ça devrait afficher une page sans erreur
fermez le navigateur internet et retournez dans le terminal
ctrl + c pour quitter le script
puis

sudo nano /etc/systemd/system/etherpad-lite.service

et coller

[Unit]
Description=etherpad-lite (real-time collaborative document editing)
After=syslog.target network.target

[Service]
Type=simple
User=etherpad-lite
Group=etherpad-lite
ExecStart=/bin/sh /srv/etherpad-lite/bin/run.sh

[Install]
WantedBy=multi-user.target

ou en 1 copier coller

leService () {
cat << eof
[Unit]
Description=etherpad-lite (real-time collaborative document editing)
After=syslog.target network.target

[Service]
Type=simple
User=etherpad-lite
Group=etherpad-lite
ExecStart=/bin/sh /srv/etherpad-lite/bin/run.sh

[Install]
WantedBy=multi-user.target
eof
}
sudo echo "$(leService)" > /etc/systemd/system/etherpad-lite.service
sudo chown -R etherpad-lite /srv/etherpad-lite/

redémarrer ou

sudo systemctl restart etherpad-lite

des infos sur le service

sudo systemctl status etherpad-lite

Hors ligne