I've got a script that I run at startup that I use to enable brightness controls. Essentially it modifies the a couple of brightness interfaces: /sys/class/backlight/intel_backlight/brightness and /sys/class/backlight/acpi_video0/brightness. I'm trying to create a systemd service that runs the script automatically at startup, but have run into issues where the acpi_video0 interface does not exist when the service is initiated.
Right now I have the following service file:
[Unit] Description=Brightness Control Init [Service] Type=oneshot ExecStart=/usr/lib/systemd/scripts/bright_init [Install] WantedBy=multi-user.target
Using systemctl status I have verified that the script runs, but it fails to alter the acpi_video0 interface because it does not exist.
Is there a different target besides multi-user with which the service should be installed, or is there a requires/after relationship that I need to dictate?
For anyone who encounters this post and has a similar problem I implemented a workaround solution to the script that I run to initialize brightness. I stuck the following few lines to the beginning of the script run by the service:
while [[ ! -e /sys/class/backlight/acpi_video0/brightness ]] do sleep 1 done
Since nothing depends on this service the sleep is not delaying any critical programs from being initiated. I'm sure there is a better way, but hey it works.
Last edited by tyler.heck (2013-01-22 01:46:09)