-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_service_linux.sh
More file actions
42 lines (34 loc) · 1.06 KB
/
install_service_linux.sh
File metadata and controls
42 lines (34 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Check for root privileges
if [ "$EUID" -ne 0 ]; then
echo "Please run as root or with sudo"
exit 1
fi
# Set up directories and permissions
SERVICE_USER="ytservice"
INSTALL_DIR="/opt/youtube-transcriber"
LOG_DIR="/var/log/youtube-transcriber"
# Create service user if it doesn't exist
if ! id "$SERVICE_USER" &>/dev/null; then
useradd -r -s /bin/false "$SERVICE_USER"
fi
# Create directories
mkdir -p "$INSTALL_DIR"
mkdir -p "$LOG_DIR"
# Copy application files
cp server.py "$INSTALL_DIR/"
cp service.py "$INSTALL_DIR/"
cp .env "$INSTALL_DIR/"
# Set permissions
chown -R "$SERVICE_USER:$SERVICE_USER" "$INSTALL_DIR"
chown -R "$SERVICE_USER:$SERVICE_USER" "$LOG_DIR"
chmod 750 "$INSTALL_DIR"
chmod 750 "$LOG_DIR"
# Install systemd service
cp youtube-transcriber.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable youtube-transcriber
systemctl start youtube-transcriber
echo "Service installation complete!"
echo "Check service status with: systemctl status youtube-transcriber"
echo "View logs with: journalctl -u youtube-transcriber"