-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-linux.sh
More file actions
49 lines (38 loc) · 1.12 KB
/
install-linux.sh
File metadata and controls
49 lines (38 loc) · 1.12 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
43
44
45
46
47
48
49
#!/bin/bash
# Install QueryPush as a systemd service on Linux
SERVICE_NAME="querypush"
SERVICE_USER="querypush"
INSTALL_DIR="/opt/querypush"
SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service"
echo "Installing QueryPush as systemd service..."
# Create service user
sudo useradd -r -s /bin/false $SERVICE_USER
# Create install directory
sudo mkdir -p $INSTALL_DIR
sudo chown $SERVICE_USER:$SERVICE_USER $INSTALL_DIR
# Copy application files
sudo cp -r * $INSTALL_DIR/
sudo chown -R $SERVICE_USER:$SERVICE_USER $INSTALL_DIR
# Create systemd service file
sudo tee $SERVICE_FILE > /dev/null <<EOF
[Unit]
Description=QueryPush Database Query Scheduler
After=network.target
[Service]
Type=notify
ExecStart=$INSTALL_DIR/QueryPush --service
Restart=always
RestartSec=5
User=$SERVICE_USER
Group=$SERVICE_USER
WorkingDirectory=$INSTALL_DIR
SyslogIdentifier=querypush
[Install]
WantedBy=multi-user.target
EOF
# Enable and start service
sudo systemctl daemon-reload
sudo systemctl enable $SERVICE_NAME
sudo systemctl start $SERVICE_NAME
echo "QueryPush service installed and started"
echo "Use 'sudo systemctl status querypush' to check status"