You are not logged in.
i have completely migrated to systemd. now, i am trying to write a service file to run a startup script (~/.startup.sh). one of the functions of the script is to set the brightness of the screen:
echo "95" > /sys/class/backlight/intel_backlight/brightness
i created /etc/systemd/system/startup.service:
[Unit]
Description=Run startup script
[Service]
Type=oneshot
ExecStart=~/.startup.sh
[Install]
WantedBy=multi-user.target
but i get the following error:
Failed to issue method call: Unit startup.service failed to load: Invalid argument. See system logs and 'systemctl status startup.service' for details.
i have two questions:
1. what am i missing?
2. how can i avoid permission issues associated with modifying the brightness file (e.g., permission denied errors, the need to put in the password, etc.)?
thanks.
Last edited by anti-destin (2012-08-01 22:26:04)
Offline
This is probably because the file could not be found. You are using a relative path, which is the likely cause. You can read more detailed error information using journalctl.
Offline
if all you do is echo a value into a file, don't do this with a service file, use a tmpfile instead (see systemd wiki).
and yes, the problem is the relative path, it must be absolute.
Offline
thanks for the replies.
just a note: using an absolute path didn't fix the issue.
but i went ahead and created the file /etc/tmpfiles.d/backlight.conf:
w /sys/class/backlight/intel_backlight/brightness - - - - 95
and that worked.
is there a reason for recommending using a tmpfile rather than a service?
in any case, i'm marking this as solved.
Offline
is there a reason for recommending using a tmpfile rather than a service?
Offline
thanks for the clarification.
Offline