3 liens privés
"too many open files"
Parce que ulimit et /etc/security/limits.conf ne fonctionne pas avec systemd :
[Service]
Type=simple
User=farmer
....
LimitNOFILE=500000:500000
LimitNPROC=500000:500000
Sans oublier :
systemctl daemon-reload
Sur mon système qui n'a pas apparmor, mysqld démarré en ligne de commande, mais pas via systemd.
Systemd a des fonctionnalités pour protéger certains filesystem :
Change variable "ProtectHome" by "false" on "/etc/systemd/system/mysqld.service"
Reload systemd by "sudo systemctl daemon-reload"
Et pour ne pas perdre ses modifs, suivre plutôt ce lien : https://dba.stackexchange.com/questions/185302/mysql-mariadb-cannot-change-default-datadir-on-debian-9-1-server/191174
"According to Debian policy rules, you should set this option value in a custom file like /etc/systemd/system/mariadb.service.d/YOUR_CUSTOM_FILE.conf containing:"
[Service]
# Prevent accessing /home, /root and /run/user
ProtectHome=false
Savoir si le système utilise initd ou systemd
pidof /sbin/init && echo "sysvinit" || echo "other"
pidof systemd && echo "systemd" || echo "other"
Créer un fichier test.service, à mettre dans /usr/lib/systemd/system/
[Unit]
Description=Callcenter Service
[Service]
Type=oneshot
RemainAfterExit=no
User=<user>
ExecStart=<command>
ExecStop=<command>
[Install]
WantedBy=multi-user.target
Démarrer le service test
sudo systemctl start test.service
Activer le service test au démarrage
sudo systemctl enable startup.service
Lister les services démarrés
systemctl list-unit-files --state=enabled
Useful SystemD commands (hints for systemctl or systemctl vs chkconfig and service)
List all running services
systemctl
Start/stop or enable/disable services
systemctl start foo.service
Deactivates a service immediately:
systemctl stop foo.service
Restarts a service:
systemctl restart foo.service
Shows status of a service including whether it is running or not:
systemctl status foo.service
Enables a service to be started on bootup:
systemctl enable foo.service
Disables a service to not start during bootup:
systemctl disable foo.service
Check whether a service is already enabled or not:
systemctl is-enabled foo.service; echo $?
Des explications sur systemd. (via http://dooby.fr/links/?zNjMPw)
dans /var/log/journal/journal.conf :
SystemMaxUse=100M
Stockage (par défaut) dans : /var/log/journal
sudo journalctl --disk-usage
sudo journalctl --vacuum-size=100M
see also : http://unix.stackexchange.com/questions/139513/how-to-clear-journalctl
Explorer le journal :
Show all messages from date (and optional time):
# journalctl --since="2012-10-30 18:17:16"
Show all messages since 20 minutes ago:
# journalctl --since "20 min ago"
Follow new messages:
# journalctl -f
Show all messages by a specific executable:
# journalctl /usr/lib/systemd/systemd