YannStatic
  • Etiquettes
  • Liens
  • Aide

Archlinux Ruby + Jekyll + générateur site statique

  • jekyll
  •  13 juil. 2024 14 mars  2025
Afficher/cacher Sommaire

Jekyll est un générateur de sites statiques (Static Site Generators - SSG) open source gratuit qui s’appuie sur le langage de programmation Ruby.

Site statique

Option A - Ruby rbenv

Cela vous permettra d’utiliser la dernière version de rbenv sans avoir besoin d’une installation sur l’ensemble du système.

Clonez rbenv dans ~/.rbenv.

git clone https://github.com/rbenv/rbenv.git ~/.rbenv

Ajouter eval "$(rbenv init -)" à la fin du fichier ~/.bashrc

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init - --no-rehash bash)"' >> ~/.bashrc
source ~/.bashrc

rbenv peut être étendu via un système de plugins, et le wiki de rbenv inclut une liste de plugins utiles. Le plugin ruby-build est particulièrement utile, car il vous permet d’installer des versions de Ruby avec la commande rbenv install. Vous pouvez installer ruby-build depuis l’AUR.

yay -S ruby-build

Les versions

rbenv install -l
3.0.6
3.1.4
3.2.2
jruby-9.4.2.0
mruby-3.2.0
picoruby-3.0.0
truffleruby-22.3.1
truffleruby+graalvm-22.3.1

Only latest stable releases for each Ruby implementation are shown.
Use 'rbenv install --list-all / -L' to show all local versions.

Ne pas installer de version ruby 3.2.x et + car incompatible avec Jekyll

On installe la 3.1.4

rbenv install 3.1.4

Patienter quelques minutes…

==> Installed ruby-3.1.4 to /home/yann/.rbenv/versions/3.1.4

NOTE: to activate this Ruby version as the new default, run: rbenv global 3.1.4

Activation

rbenv global 3.1.4

Jekyll


Tutoriel Jekyll : Comment créer un site web statique

Évitez d’installer les paquets RubyGems (appelés gems) en tant qu’utilisateur root. A la place, mettez en place un répertoire d’installation des gems pour votre compte utilisateur. Les commandes suivantes ajouteront des variables d’environnement à votre fichier ~/.bashrc pour configurer le chemin d’installation des gems

echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Enfin, installez Jekyll et Bundler :

gem install jekyll bundler

Vérification

jekyll -v

jekyll 4.3.3

Option B - Ruby (CHOIX PAR DEFAUT)

Installation ruby

Utilisez le gestionnaire de packages Arch Linux pacman pour mettre à jour votre système

sudo pacman -Syu

Ensuite, utilisez pacman à nouveau pour installer les packages rubyet base-devel

sudo pacman -S ruby ruby-erb # base-devel installé par défaut

Ruby et Gem sont installés

[yann@PC1 ~]$ ruby -v
ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [x86_64-linux]
[yann@PC1 ~]$ gem -v
3.5.16

Installation des gemmes

Lorsqu’il s’agit d’installer des gemmes, il existe au moins les trois manières suivantes d’installer des gemmes sur Arch Linux :

  • bundle install stocke des versions spécifiques de gemmes pour chaque projet Ruby on Rails.
  • gem install stocke les versions spécifiques de Ruby des gemmes stockées sur votre machine locale.
  • pacman -S ruby-GEM_NAME stocke les gemmes dans tout le système, pour tous les utilisateurs.

Installer Jekyll et Bundler

gem install jekyll bundler

Résultat

WARNING:  You don't have /home/yann/.local/share/gem/ruby/3.3.0/bin in your PATH,
	  gem executables will not run.

Successfully installed bundler-2.5.23
31 gems installed

On ajoute le path .bashrc

export PATH="$HOME/.local/share/gem/ruby/3.3.0/bin:$PATH"
export GEM_HOME="$HOME/.local/share/gem/ruby/3.3.0/gems"

Valider

source $HOME/.bashrc

Les versions installées : ruby -v && gem -v && bundle -v && jekyll -v

[yann@PC1 ~]$ ruby -v
ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [x86_64-linux]
[yann@PC1 ~]$ gem -v
3.5.16
[yann@PC1 ~]$ bundle -v
Bundler version 2.5.23
[yann@PC1 ~]$ jekyll -v
jekyll 4.3.4

Environnement gem: gem env

RubyGems Environment:
  - RUBYGEMS VERSION: 3.5.16
  - RUBY VERSION: 3.3.5 (2024-09-03 patchlevel 100) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/yann/.local/share/gem/ruby/3.3.0/gems
  - USER INSTALLATION DIRECTORY: /home/yann/.local/share/gem/ruby/3.3.0
  - RUBY EXECUTABLE: /usr/bin/ruby
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /home/yann/.local/share/gem/ruby/3.3.0/gems/bin
  - SPEC CACHE DIRECTORY: /home/yann/.cache/gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - x86_64-linux
  - GEM PATHS:
     - /home/yann/.local/share/gem/ruby/3.3.0/gems
     - /home/yann/.local/share/gem/ruby/3.3.0
     - /usr/lib/ruby/gems/3.3.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => true
     - :bulk_threshold => 1000
     - "gem" => "--user-install"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/yann/.local/share/gem/ruby/3.3.0/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/local/sbin
     - /usr/lib/jvm/default/bin
     - /usr/bin/site_perl
     - /usr/bin/vendor_perl
     - /usr/bin/core_perl

yannstatic

Se positionner dans le dossier

cd ~/media/yannstatic

Le fichier _config.yml

(Afficher/Cacher) _config.yml
# Bienvenue à Jekyll !
#
# Ce fichier de configuration est destiné aux paramètres qui affectent l'ensemble de votre blog, des valeurs
# que vous êtes censé configurer une fois et rarement besoin de modifier par la suite.
# Pour des raisons techniques, ce fichier n'est *PAS* rechargé automatiquement lorsque vous utilisez
# 'jekyll serve'. Si vous modifiez ce fichier, veuillez redémarrer le processus de serveur.
#
# Modification octobre 2024

## => Paramètres du site
##############################
theme             : jekyll-text-theme
text_skin         : dark                          # "default" (par défaut), "dark", "forest", "ocean", "chocolate", "orange".
highlight_theme   : tomorrow-night-bright         # "default" (par défaut), "tomorrow", "tomorrow-night", "tomorrow-night-eighties", "tomorrow-night-blue", "tomorrow-night-bright".
url               : https://static.rnmkcy.eu      # le nom d'hôte et le protocole de base pour votre site, par exemple https://www.someone.com
baseurl           :                               # ne comprend pas le nom d'hôte
title             : YannStatic
description       : >                             # cela signifie qu'il faut ignorer les nouvelles lignes jusqu'à "Language & timezone".
  Expérimentations et tests

## => Language and Timezone
##############################
lang        : fr               # le language du site, par défaut "en"
timezone    : Europe/Paris     # voir https://en.wikipedia.org/wiki/List_of_tz_database_time_zones


## => Chemins
##############################
paths:
  root    : # title link url, "/" (default)
  home    : # home layout url, "/" (default)
  archive : # "/archive.html" (default)
  rss     : # "/feed.xml" (default)


## => Post
##############################
## excerpt
excerpt_separator: 

## license
license: # "CC-BY-4.0", "CC-BY-SA-4.0", "CC-BY-NC-4.0", "CC-BY-ND-4.0"

## TOC
toc:
  selectors: h1,h2,h3 # "h1,h2,h3" (default)


## => Paginate
##############################
paginate: 10
## paginate_path: /page:num # don't change this unless for special need


## => Sources
##############################
sources:            # bootcdn (default), unpkg


## => Recherche
##############################
search:
  provider: "custom" # "default" (default), false, "custom"

## => Build
##############################
markdown    : kramdown
highlighter : rouge
permalink   : date

# http://jekyllrb.com/docs/configuration/options/
exclude: [LISEZMOI.md,.jekyll-cache/,.git/,Gemfile,Gemfile.lock,static]
include: [search.json]

defaults:
  - scope:
      path: ""
      type: posts
    values:
      layout: article
      sharing: true
      license: false # true
      aside:
        toc: true
      show_edit_on_github: true
      show_subscribe: true
      pageview: true
 

## => Plugins
##############################
plugins:
  - jekyll-feed
  - jekyll-paginate
  - jekyll-sitemap
  - jemoji

Le fichier Gemfile $HOME/media/yannstatic/Gemfile

source "https://rubygems.org"

# gem "github-pages", group: :jekyll_plugins
gem "jekyll-text-theme"
gem "html-pipeline"
gem "sass-embedded", "1.85.1"

Supprimer , si existant, le fichier Gemfile.lock

Bundle lit le fichier Gemfile

bundle install # Patientez ...
Bundle complete! 3 Gemfile dependencies, 51 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

Info sur jekyll et créer un lien

bundle info jekyll
  * jekyll (4.3.4)
	Summary: A simple, blog aware, static site generator.
	Homepage: https://jekyllrb.com
	Source Code: https://github.com/jekyll/jekyll
	Changelog: https://github.com/jekyll/jekyll/releases
	Bug Tracker: https://github.com/jekyll/jekyll/issues
	Path: /home/yann/.local/share/gem/ruby/3.3.0/gems/jekyll-4.3.4
	Reverse Dependencies: 
		jekyll-feed (0.17.0) depends on jekyll (>= 3.7, < 5.0)
		jekyll-sitemap (1.4.0) depends on jekyll (>= 3.7, < 5.0)
		jekyll-text-theme (2.2.6) depends on jekyll (>= 3.6, < 5.0)
		jemoji (0.13.0) depends on jekyll (>= 3.0, < 5.0)

Création des liens sur les dossiers files , images , _posts et htmldoc

ln -s /srv/media/statique/images /srv/media/yannstatic/images
ln -s /srv/media/statique/files /srv/media/yannstatic/files
ln -s /srv/media/statique/_posts /srv/media/yannstatic/_posts
ln -s /srv/media/statique/htmldoc /srv/media/yannstatic/htmldoc
ln -s /srv/media/statique/htmldoc/htmldoc.md /srv/media/yannstatic/htmldoc.md

La structure des liens : ls -l $HOME/media/yannstatic/ |grep ^l

lrwxrwxrwx   1 yann yann    25 21 nov.  11:55 files -> /srv/media/statique/files
lrwxrwxrwx   1 yann yann    27 21 nov.  11:55 htmldoc -> /srv/media/statique/htmldoc
lrwxrwxrwx   1 yann yann    38 21 nov.  11:55 htmldoc.md -> /srv/media/statique/htmldoc/htmldoc.md
lrwxrwxrwx   1 yann yann    26 21 nov.  11:55 images -> /srv/media/statique/images
lrwxrwxrwx   1 yann yann    26 21 nov.  11:55 _posts -> /srv/media/statique/_posts

Génération dossier “static”

Création du dossier static , par défaut c’est _site

cd ~/media/yannstatic
bundle exec jekyll build --source "/srv/media/yannstatic" --destination "/srv/media/yannstatic/static"
Configuration file: /srv/media/yannstatic/_config.yml
            Source: /srv/media/yannstatic
       Destination: /srv/media/yannstatic/static
 Incremental build: disabled. Enable with --incremental
      Generating... 
       Jekyll Feed: Generating feed for posts
                    done in 16.146 seconds.
 Auto-regeneration: disabled. Use --watch to enable.

Service yannstatic

On veut générer un dossier nommé 'static'

PATH Jekyll : which bundle → /home/yann/.local/share/gem/ruby/3.3.0/bin/bundle

Pour lancer le serveur yannstatic au démarrage, utilisation d’un service systemd utilisateur

Les variables environnement, générer le fichier

env > /srv/media/yannstatic/.env_file

Création d’un service utilisateur “yannstatic” sous systemd

mkdir -p ~/.config/systemd/user
nano ~/.config/systemd/user/yannstatic.service

Contenu du fichier yannstatic.service

[Unit]
Description=service yannstatic

[Service]
EnvironmentFile=/srv/media/yannstatic/.env_file
WorkingDirectory=/srv/media/yannstatic
ExecStart=/home/yann/.local/share/gem/ruby/3.3.0/bin/bundle exec jekyll build --watch --incremental --source "/srv/media/yannstatic" --destination "/srv/media/yannstatic/static"
Restart=on-abort

[Install]
WantedBy=default.target

Lancer le service yannstatic :

systemctl --user daemon-reload
systemctl --user start yannstatic

Vérifier

systemctl --user status yannstatic
● yannstatic.service - service yannstatic
     Loaded: loaded (/home/yann/.config/systemd/user/yannstatic.service; disabled; preset: enabled)
     Active: active (running) since Sat 2024-07-13 17:41:11 CEST; 5s ago
 Invocation: 3ca89242aa6c4c3ab221b4f44a7d9cc1
   Main PID: 116020 (bundle)
      Tasks: 1 (limit: 38321)
     Memory: 144.2M (peak: 144.2M)
        CPU: 5.638s
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/yannstatic.service
             └─116020 "/home/yann/gems/bin/jekyll build --watch --incremental --source /srv/media/yannstatic --destination /srv/media/yannstatic/static"

juil. 13 17:41:11 yann-pc1 systemd[1798]: Started service yannstatic.
juil. 13 17:41:12 yann-pc1 bundle[116020]: Configuration file: /srv/media/yannstatic/_config.yml
juil. 13 17:41:12 yann-pc1 bundle[116020]:             Source: /srv/media/yannstatic
juil. 13 17:41:12 yann-pc1 bundle[116020]:        Destination: /srv/media/yannstatic/static
juil. 13 17:41:12 yann-pc1 bundle[116020]:  Incremental build: enabled
juil. 13 17:41:12 yann-pc1 bundle[116020]:       Generating...
juil. 13 17:41:12 yann-pc1 bundle[116020]:        Jekyll Feed: Generating feed for posts

Activation

systemctl --user enable yannstatic

dire à systemd que l’instance d’un utilisateur soit tout le temps présente, du boot au shutdown, ce qui permet d’avoir des processus (services) utilisateurs qui tournent sans avoir de session ouverte.

sudo loginctl enable-linger $USER

Pour observer le fonctionnement du service yannstatic depuis la machine virtuelle debian

journalctl -f --user-unit yannstatic.service
nov. 21 15:15:22 PC1 bundle[2647]: csv was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
nov. 21 15:15:22 PC1 bundle[2647]: You can add csv to your Gemfile or gemspec to silence this warning.
nov. 21 15:15:22 PC1 bundle[2647]: /usr/lib/ruby/3.3.0/json/common.rb:3: warning: ostruct was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.
nov. 21 15:15:22 PC1 bundle[2647]: You can add ostruct to your Gemfile or gemspec to silence this warning.
nov. 21 15:15:23 PC1 bundle[2647]: Configuration file: /srv/media/yannstatic/_config.yml
nov. 21 15:15:23 PC1 bundle[2647]:             Source: /srv/media/yannstatic
nov. 21 15:15:23 PC1 bundle[2647]:        Destination: /srv/media/yannstatic/static
nov. 21 15:15:23 PC1 bundle[2647]:  Incremental build: enabled
nov. 21 15:15:23 PC1 bundle[2647]:       Generating...
nov. 21 15:15:23 PC1 bundle[2647]:        Jekyll Feed: Generating feed for posts

Synchro serveur dossier “static”

Le but est de synchroniser le dossier ~/media/yannstatic/static avec le(s) serveur(s) web distant(s)
A chaque création, modification ou suppression d’un POST mardown le sous-dossier static/ est reconstruit (jekyll build)
Avec les unités de chemin, vous pouvez surveiller les fichiers et les répertoires pour certains événements. Si un événement spécifique se produit, une unité de service est exécutée, et elle porte généralement le même nom que l’unité de chemin

Nous allons surveiller dansle dossier /srv/media/statique/_posts/ toute modification du fichier sitemap.xml qui entrainera l’exécution d’un script

Dans le répertoire systemd utilisateur nous créons une unité de cheminement media_yannstatic_site.path

nano ~/.config/systemd/user/media_yannstatic_site.path
[Unit]
Description=Surveiller sitemap.xml pour les changements

[Path]
PathChanged=/home/yann/media/yannstatic/static/sitemap.xml
Unit=media_yannstatic_site.service

[Install]
WantedBy=default.target

Dans la section [Path], PathChanged= indique le chemin absolu du fichier à surveiller, tandis que Unit= indique l’unité de service à exécuter si le fichier change. Cette unité (media_yannstatic_site.path) doit être lancée lorsque le système est en mode multi-utilisateur.

Ensuite, nous créons l’unité de service correspondante, media_yannstatic_site.service, dans le répertoire ~/.config/systemd/user/
Si le fichier sitemap.xml change (c’est-à-dire qu’il est à la fois écrit et fermé), l’unité de service suivante sera appelée pour exécuter le script spécifié :

nano ~/.config/systemd/user/media_yannstatic_site.service
[Unit] 
Description="Exécute le script si site.xml a été modifié."

[Service]
ExecStart=/home/yann/scripts/media_yannstatic_site.sh

Le script media_yannstatic_site.sh lance une synchronisation locale distante via rsync ssh

Etendre Réduire media_yannstatic_site.sh
#!/bin/bash

#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Modification mode rsync suivant serveur distant
# 2023-09-21 suppression ligne suivante dans fichier /home/yann/scripts/serveurs.csv
# xoyaz.xyz,/home/yunohost.multimedia/share,yann@xoyaz.xyz,55156,/home/yann/.ssh/time4vps,sudo rsync 
# 
# 2023-09-16 Liste des serveurs dans un fichier /home/yann/scripts/serveurs.csv
#
# Chaque modification du fichier site.xml dans le dossier local /home/yann/media/yannstatic/_site
# déclenche une synchronisation du dossier local  avec le dossier distant '/home/yunohost.multimedia/share/Divers/static' 
# des serveurs VPS Yunohost
# le dossier local est également sauvegardé dans le dossier 'backup/datayan/static' de la boîte de stockage
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

# Fonction pour tester si le serveur est présent
# Host=$1 et Port=$2
# Réponse $?=0 -> OK  $?=1 -> NOK
host_ok () {
 nc -4 -d -z -w 1 $1 $2 &> /dev/null
}

synchro () {
# Synchronisation locale distante du dossier _site
host_ok $SERVER $PORT 
if [[ $? == 0 ]]
then



echo 'rsync -avz --progress --stats --human-readable --delete -e "ssh -p '$PORT' -i '$PRIVKEY'" '$REPLOC' '$USERDIS':'$REPDIS'/Divers/'
rsync -avz --progress --stats --human-readable --delete --rsync-path="$RSYNCMOD" -e "ssh -p $PORT -i $PRIVKEY" $REPLOC $USERDIS:$REPDIS/Divers/ > /dev/null

	 # Analyse résultat de la commande rsync
	 if [ ! $? -eq 0 ]; then 
		 #echo "Synchro $REPLOC avec $SERVER -> OK" | systemd-cat -t yannstatic -p info 
		 #echo "Synchro $REPLOC avec $SERVER -> OK"
	 #else 
		 echo "Synchro $REPLOC avec $SERVER -> ERREUR" | systemd-cat -t yannstatic -p emerg 
		 #echo "Synchro $REPLOC avec $SERVER -> ERREUR"
	 fi
else
    echo "Site $SERVER port $PORT Inaccessible !" | systemd-cat -t yannstatic -p emerg
    #echo "Site $SERVER port $PORT Inaccessible !"
fi

}

#*******************************************************************
#
# DEPART SCRIPT
#
#*******************************************************************

# Tester la présence du fichier
if [ ! -f /home/yann/scripts/serveurs.csv ]; then
    echo "Fichier serveurs.csv inexistant!" | systemd-cat -t yannstatic -p emerg
    exit 1
fi

# Mesure temps exécution
begin=$(date +"%s")
echo "***DEPART*** Exécution script $0"
echo "***DEPART*** Exécution script $0" | systemd-cat -t yannstatic -p info
#echo "Exécution script $0"

# Dossier local
REPLOC="/home/yann/media/yannstatic/static" 

# Synchro serveurs
while IFS="," read -r SERVER REPDIS USERDIS PORT PRIVKEY RSYNCMOD LOCAL
do
  #echo " $SERVER $REPDIS $USERDIS $PORT $PRIVKEY $RSYNCMOD $LOCAL"
 
   if [[ "$LOCAL" != "oui" ]]; then
     # non --> Opération sur des sites distants
  		synchro
   fi
done < <(tail -n +2 /home/yann/scripts/serveurs.csv)

# Calcul et affichage temps exécution
termin=$(date +"%s")
difftimelps=$(($termin-$begin))
echo "***FIN*** $0 exécuté en $(($difftimelps / 60)) mn $(($difftimelps % 60)) s" | systemd-cat -t yannstatic -p info
echo "***FIN*** $0 exécuté en $(($difftimelps / 60)) mn $(($difftimelps % 60)) s"

exit 0

Activation et lancement

systemctl --user enable media_yannstatic_site.path
systemctl --user start media_yannstatic_site.path

Voir le fichier journal

journalctl --user -f -u media_yannstatic_site.service
nov. 21 15:24:43 PC1 media_yannstatic_site.sh[2794]: rsync -avz --progress --stats --human-readable --delete -e "ssh -p 23 -i /home/yann/.ssh/bx11-yann-ed25519" /home/yann/media/yannstatic/static u326239@u326239.your-storagebox.de:backup/datayan/Divers/
nov. 21 15:24:57 PC1 media_yannstatic_site.sh[2794]: rsync -avz --progress --stats --human-readable --delete -e "ssh -p 55215 -i /home/yann/.ssh/lenovo-ed25519" /home/yann/media/yannstatic/static leno@192.168.0.215:/sharenfs/multimedia/Divers/
nov. 21 15:24:59 PC1 media_yannstatic_site.sh[2794]: ***FIN*** /home/yann/scripts/media_yannstatic_site.sh exécuté en 0 mn 16 s
nov. 21 15:24:59 PC1 systemd[1423]: media_yannstatic_site.service: Consumed 2.193s CPU time, 16.1M memory peak.

On peut créer un accès graphique sur le poste archlinux

~/.local/share/applications/suivi_yannstatic_site.desktop
[Desktop Entry]
Version=1.1
Type=Application
Name=Synchro modification site
Comment=suivi_yannstatic_site.sh
Icon=xterm-color_48x48
Exec=xterm -rv -geometry 290x40+100+150 -T suivi_yannstatic_site -e '/home/yann/scripts/suivi_yannstatic_site.sh'
Actions=
Categories=Utility;
Path=
Terminal=false
StartupNotify=false

Le script

~/scripts/suivi_yannstatic_site.sh
#!/bin/bash    

# COLUMNSxROWS+X+Y -> xterm -geometry 400x200+100+350
# xterm -rv -geometry 150x40+100+150 -T suivi_yannstatic_site -e '/home/yann/scripts/suivi_yannstatic_site.sh'
# On supprime la session "lxcSess" si existante                         
 
if [[ `tmux list-sessions | grep 'lxcSess' | wc -l` != 0 ]]
   then  
       # On ferme la session active
       tmux kill-session -t lxcSess
fi


# Créer une bannière dans /etc/motd sur chaque serveur
# Nom du domaine en ascii voir lien http://patorjk.com/software/taag/#p=display&h=1&f=Small
echo "fin fi"
# Créer session + terminal 
tmux new  -d -s lxcSess -n lxcTerm
# Séparation horizontale en 2 du terminal
tmux split-window -v -p 50
# | 0         |
# |           |
# |-----------|
# | 1         |
# |           |
# Sélection terminal HAUT
tmux selectp -t 0
# 
tmux send-keys -t lxcSess "journalctl --user -f -u yannstatic.service" C-m
# Sélection terminal BAS
tmux selectp -t 1
#  
tmux send-keys -t lxcSess "journalctl --user -f -u media_yannstatic_site.service" C-m

# Afficher la session 
tmux a -t lxcSess
#
# Tuer la session
# tmux kill-session -t lxcSess

Le rendre exécutable

chmod +x scripts/suivi_yannstatic_site.sh

Aperçu…

PRÉCÉDENTcwwk KVM - Alpine Linux Tiny Tiny RSS (ttrss alpine-vm)
SUIVANTAlpine Linux - serveur web Caddy
Recherche