Peter Lemenkov
2012-05-26 06:27:23 UTC
Hello All!
I've got Apple Mac keyboard which behaviour depends on a value stored
in /sys/module/hid_apple/parameters/fnmode file (default is "1").
Before systemd I did the following - I added the "echo 2 >
/sys/module/hid_apple/parameters/fnmode" line to the end of
/etc/rc.d/rc.local . Recently I tried to do the same using native
systemd *.service file and quickly created the following one:
======================
[Unit]
Description=Fix Apple Keyboard Fn Behaviour
[Service]
Type=oneshot
RemainAfterExit=yes
ConditionPathExists=/sys/module/hid_apple/parameters/fnmode
ExecStart=/bin/echo 2 > /sys/module/hid_apple/parameters/fnmode
[Install]
WantedBy=multi-user.target
======================
Unfortunately it doesn't work at all. Although systemctl tells me that
everything is ok, the contents of the
/sys/module/hid_apple/parameters/fnmode file remains intact. After a
brief examination I found that I just can't simply redirect stdout to
the file (e.g. if I change ExecStart to someting like this
"ExecStart=/bin/echo 2 > /tmp/test.txt" then the file /tmp/test.txt"
will not be created).
So questions are
* Can I somehow modify the given file from systemd files w/o too much
efforts? "Too much" means w/o writing simple console utility only with
systemd+shell means.
* How to restore the original ">" and "<" behaviour if required?
I've got Apple Mac keyboard which behaviour depends on a value stored
in /sys/module/hid_apple/parameters/fnmode file (default is "1").
Before systemd I did the following - I added the "echo 2 >
/sys/module/hid_apple/parameters/fnmode" line to the end of
/etc/rc.d/rc.local . Recently I tried to do the same using native
systemd *.service file and quickly created the following one:
======================
[Unit]
Description=Fix Apple Keyboard Fn Behaviour
[Service]
Type=oneshot
RemainAfterExit=yes
ConditionPathExists=/sys/module/hid_apple/parameters/fnmode
ExecStart=/bin/echo 2 > /sys/module/hid_apple/parameters/fnmode
[Install]
WantedBy=multi-user.target
======================
Unfortunately it doesn't work at all. Although systemctl tells me that
everything is ok, the contents of the
/sys/module/hid_apple/parameters/fnmode file remains intact. After a
brief examination I found that I just can't simply redirect stdout to
the file (e.g. if I change ExecStart to someting like this
"ExecStart=/bin/echo 2 > /tmp/test.txt" then the file /tmp/test.txt"
will not be created).
So questions are
* Can I somehow modify the given file from systemd files w/o too much
efforts? "Too much" means w/o writing simple console utility only with
systemd+shell means.
* How to restore the original ">" and "<" behaviour if required?
--
With best regards, Peter Lemenkov.
With best regards, Peter Lemenkov.