Files
kspsuti-teacher-schedule/install-service.sh
2026-03-02 14:21:02 +04:00

26 lines
752 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Запускать с sudo: sudo bash install-service.sh
# Должен быть запущен из папки с проектом
set -e
PROJECT_DIR="$(cd "$(dirname "$0")" && pwd)"
SERVICE_USER="${SUDO_USER:-$(whoami)}"
echo "==> Устанавливаем systemd сервис..."
echo " Папка проекта : $PROJECT_DIR"
echo " Пользователь : $SERVICE_USER"
sed \
-e "s|__PROJECT_DIR__|$PROJECT_DIR|g" \
-e "s|__SERVICE_USER__|$SERVICE_USER|g" \
"$PROJECT_DIR/schedule.service.template" \
> /etc/systemd/system/schedule.service
systemctl daemon-reload
systemctl enable schedule
systemctl restart schedule
echo ""
echo "✓ Сервис запущен!"
systemctl status schedule --no-pager -l