1. Создать bash скрипт для запуска нужного приложения.
2. Создать файл в /etc/systemd/system/my_service.service следующего содержания:
[Unit] Description=A description my_service After=network.target [Service] Type=simple ExecStart=/bin/bash /home/.../start_my_service.sh TimeoutStartSec=0 [Install] WantedBy=default.target
Перечитать сервисы:
$ sudo systemctl daemon-reload
Включить сервис:
$ systemctl enable my_service.service
Проверить:
$ systemctl --all | grep my_service.service my_service.service loaded active running A description my_service
и
$ systemctl status my_service
или
$ systemctl is-active my_service enabled
или
$ systemctl is-enabled my_service enabled
Старт сервиса:
$ systemctl start my_service.service
Сколько памяти занимает сервис:
$ ps aux --no-headers | grep "apache2" | awk '{sum+=$6} END {print "Total RSS:", sum/1024, "MB"}'
Total RSS: 411.844 MB
Ссылки:
https://help.skysilk.com/support/solutions/articles/9000162390--basic-how-to-start-a-program-or-script-on-linux-automatically-on-boot-with-systemd
Раскрашенный log:
$ grc tail -f /var/log/syslog