Skip to content

Commit

Permalink
Merge pull request #693 from CachyOS/feature/scx-loader-systemd-service
Browse files Browse the repository at this point in the history
scx_loader: Add systemd service and on-DBUS launch
  • Loading branch information
htejun authored Sep 27, 2024
2 parents 1967328 + 9b5e8da commit c19b391
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
36 changes: 36 additions & 0 deletions rust/scx_loader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,42 @@

**Note:** Replace the example scheduler names and arguments with the actual ones you want to use.

## DBUS and Systemd Service

`scx_loader` provides the `org.scx.Loader` DBUS service and is automatically started by `dbus-daemon` when an application calls into this service. Users and administrators do not need to manually start the `scx_loader` daemon.

`scx_loader` is managed by the `scx_loader.service` systemd unit. This service is distinct from the `scx.service` unit, which is used to manage schedulers directly (without DBUS).

## Debugging

In case of issues with `scx_loader`, you can debug the service using the following steps:

1. **Check the service status:**
```bash
systemctl status scx_loader.service
```

2. **View the service logs:**
```bash
journalctl -u scx_loader.service
```

3. **Enable debug logging:** You can temporarily enable debug logging by modifying the systemd service file:

- Edit the service file:
```bash
sudo systemctl edit scx_loader.service
```
- Add the following lines under the `[Service]` section:
```
Environment=RUST_LOG=trace
```
- Restart the service:
```bash
sudo systemctl restart scx_loader.service
```
- Check the logs again for detailed debugging information.

## Development Status

`scx_loader` is under active development. Future improvements may include:
Expand Down
6 changes: 6 additions & 0 deletions services/systemd/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@ systemd_system_unit_dir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir
# Install the 'scx.service' file to the systemd system unit directory
install_data('scx.service', install_dir: systemd_system_unit_dir)

# Install the 'scx_loader.service' file to the systemd system unit directory
install_data('scx_loader.service', install_dir: systemd_system_unit_dir)

# Install the 'org.scx.Loader.service' file to the dbus system services directory
install_data('org.scx.Loader.service', install_dir: '/usr/share/dbus-1/system-services')

# Install the 'scx' file to the '/etc/default' directory
install_data('../scx', install_dir: '/etc/default')
5 changes: 5 additions & 0 deletions services/systemd/org.scx.Loader.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[D-BUS Service]
Name=org.scx.Loader
Exec=/usr/bin/scx_loader
User=root
SystemdService=scx_loader.service
11 changes: 11 additions & 0 deletions services/systemd/scx_loader.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=DBUS on-demand loader of sched-ext schedulers

[Service]
Type=dbus
BusName=org.scx.Loader
ExecStart=/usr/bin/scx_loader
KillSignal=SIGINT

[Install]
WantedBy=graphical.target

0 comments on commit c19b391

Please sign in to comment.