Hello,
I'm attempting to add a custom script to run at boot time
(as root) by using the systemd services (as per explanation
at "http://docs.fedoraproject.org/en-US/Fedora/19/html/Installation_Guide/s1-boot-init-shutdown-run-boot.html").
I created the file
/lib/systemd/system/ka_setup_tty.service
with the contents:
Code:
[Unit]
Description=A service that executes a user script on startup (setting up /dev/ttyS0).
Wants=network.target
[Service]
ExecStart=/root/bin/setup_ttyS0_for_ka
Type=oneshot
[Install]
WantedBy=multi-user.target
Then I created the script /root/bin/setup_ttyS0_for_ka
with contents:
Code:
#!/bin/tcsh
chmod o+rw /dev/ttyS0
stty -F /dev/ttyS0 19200
(I'm building some hardware than uses RS-232 interface
and I want to save me the repeated action of changing the ttyS0
parameters as a root each time I turn the PC on and start
working, I would like the setup to be done during the boot time.)
I checked that running the "/root/bin/setup_ttyS0_for_ka"
as a root does what I need but when I reboot, I see that
nothing changed in the ttyS0 setup, therefore the script didn't
run (successfully). Did I made an error with
"Wants=network.target"
or
"WantedBy=multi-user.target"?
I just left these lines as in example.
What service sets up all the serial ports, maybe I need to
wait for its end?
Am I right assuming that when "systemd" parses the "*.service"
files and executes what's in them, it runs as "root"?
Does anyone sees something obvious I forgot?
TIA for any ideas,