The way I got my rc.local to work was to execute the following as root:
Code:
ln -s /lib/systemd/system/rc-local.service /etc/systemd/system/multi-user.target.wants/rc-local.service
Then I wrote the /etc/rc.d/rc.local file (the first line being #!/bin/sh like yours) and make that file executable:
Code:
chmod 755 /etc/rc.d/rc.local
I then enabled it with:
Code:
systemctl enable rc-local.service
so that it ran on each boot up. In my case I used the rc.local file to create some links in /dev and make a /dev/dsp and it all worked. Now, when I ask systemctl the status of rc-local.service I get:
Quote:
rc-local.service - /etc/rc.d/rc.local Compatibility
Loaded: loaded (/usr/lib/systemd/system/rc-local.service; enabled)
Active: active (exited) since Thu, 02 Aug 2012 08:47:08 +1000; 1h 17min ago
Process: 721 ExecStart=/etc/rc.d/rc.local start (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/rc-local.service
|
and everything works as intended from my point of view.
From your first quote it looks as if you are trying to make the rc.local file executable from within the rc.local file itself. I can't see how this can work. If the rc.local file is not executable when the operating system first sees it (without looking into its contents), it ignores it. Rather, the rc.local file should be made executable by your chmod command before the operating system tries to execute it. I would remove the chmod and ln commands from your rc.local file, keep the rest of it, and try the above approach which I have outlined to see how that goes, bearing in mind that the commands in your rc.local file have to be workable as well on your system for it all to work. ben.