Skip to content

Commit

Permalink
Restart Linux service on login (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
infeeeee committed May 18, 2024
1 parent 77e10b4 commit ba2aa9f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
19 changes: 16 additions & 3 deletions docs/Autostart tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ sudo cp docs/IoTuring.service /usr/lib/systemd/user/
mkdir -p ~/.local/share/systemd/user/
cp docs/IoTuring.service ~/.local/share/systemd/user/

# Enable the automatic login of the user, so it can start after boot
loginctl enable-linger $(whoami)

systemctl --user daemon-reload
systemctl --user edit IoTuring.service
```
Expand All @@ -71,6 +68,22 @@ systemctl --user enable IoTuring.service
systemctl --user start IoTuring.service
```

#### Start user service before login

This is optional. Without this, IoTuring starts after login.

```shell
# Enable the automatic login of the user, so IoTuring can start right after boot:
loginctl enable-linger $(whoami)

# Copy the service which restarts IoTuring:
cp docs/IoTuring-restart.service ~/.local/share/systemd/user/

systemctl --user daemon-reload
systemctl --user enable IoTuring-restart.service
systemctl --user start IoTuring-restart.service
```

### As a system service with Systemd

Some entities may not work if installed as a system service
Expand Down
9 changes: 9 additions & 0 deletions docs/IoTuring-restart.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Restart IoTuring after login

[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl --user restart IoTuring.service

[Install]
WantedBy=graphical-session.target

0 comments on commit ba2aa9f

Please sign in to comment.