-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
89583c4
commit 1f64741
Showing
1 changed file
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,38 @@ | ||
#!/bin/bash | ||
# copy this file to "~/.config/autostart/" | ||
|
||
python3 ~/ShelfSlide/shelfslide.py | ||
# Path to the Python program | ||
PROGRAM_PATH="$HOME/ShelfSlide/shelfslide.py" | ||
|
||
# Name of the systemd service | ||
SERVICE_NAME="shelfslide" | ||
|
||
# Get the username of the person running the script | ||
CURRENT_USER="$USER" | ||
|
||
# Create the unit file | ||
cat <<EOF > /etc/systemd/system/${SERVICE_NAME}.service | ||
[Unit] | ||
Description=ShelfSlide Python Program | ||
After=network.target | ||
[Service] | ||
ExecStart=/usr/bin/python3 ${PROGRAM_PATH} | ||
WorkingDirectory=$HOME/ShelfSlide | ||
StandardOutput=inherit | ||
StandardError=inherit | ||
Restart=always | ||
User=$CURRENT_USER | ||
[Install] | ||
WantedBy=multi-user.target | ||
EOF | ||
|
||
# Reload systemd | ||
systemctl daemon-reload | ||
|
||
# Enable and start the service | ||
systemctl enable ${SERVICE_NAME} | ||
systemctl start ${SERVICE_NAME} | ||
|
||
# Display the status of the service | ||
systemctl status ${SERVICE_NAME} |