I have a program that disables a couple of leds on my banana pi. It runs fine when I place it in the /etc/bash.bashrc file. But I'd like it to run when the pi starts up, and not once someone logs in.
So I create a file called /etc/systemd/system/disable_leds.service:
$this->bbcode_second_pass_code('', '[Unit]
After=network.target
Requires=network.target
Description=Disable LEDS
[Install]
WantedBy=multi-user.target
[Service]
User=root
Type=oneshot
RemainAfterExit=yes
ExecStart=/dea/programs/dea_turn_off_leds')
And ran the command:
$this->bbcode_second_pass_code('', 'systemctl enable disable_leds')
But after rebooting and issuing the command:
$this->bbcode_second_pass_code('', 'systemctl status -l disable_leds')
It says:
$this->bbcode_second_pass_code('', '* disable_leds.service - Disable LEDS
Loaded: loaded (/etc/systemd/system/disable_leds.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2015-02-28 13:15:51 MST; 4min 23s ago
Process: 122 ExecStart=/dea/programs/dea_turn_off_leds (code=exited, status=1/FAILURE)
Main PID: 122 (code=exited, status=1/FAILURE)
Feb 28 13:15:51 nana systemd[1]: Starting Disable LEDS...
Feb 28 13:15:51 nana systemd[1]: disable_leds.service: main process exited, code=exited, status=1/FAILURE
Feb 28 13:15:51 nana dea_turn_off_leds[122]: SIOCGMIIPHY on eth0 failed: Invalid argument
Feb 28 13:15:51 nana systemd[1]: Failed to start Disable LEDS.
Feb 28 13:15:51 nana systemd[1]: Unit disable_leds.service entered failed state.
Feb 28 13:15:51 nana systemd[1]: disable_leds.service failed.')
And so I'm lost. The program runs fine once the system is up, so I have to believe that it's because the interface eth0 has not been initialized by the time the program is run. I need it to be run as root with eth0 enabled. Can anybody help me?
uname -a:
$this->bbcode_second_pass_code('', 'Linux nana 3.4.90 #1 SMP PREEMPT Wed Jul 2 15:10:20 CST 2014 armv7l GNU/Linux')