Wiki‎ > ‎

After.local

posted Jul 20, 2016, 7:16 PM by Dong Xu

You can also write your scripts and then execute them from

/etc/init.d/after.local
and
/etc/init.d/halt.local

The after.local script will be run after all the run levels have completed, and the halt.local script will run before any of the run level shutdown scripting starts.  after.local doesn’t exist by default, but it will get executed by /etc/init.d/rc if it does exist.
Additionally, if you want to run something before any of the runlevels start, you can put it in

/etc/init.d/boot.local
and/or
/etc/init.d/before.local

After looking at these last two, i’m not really sure what the difference between them are. They appear to have the same function.
===========================================
After enabling the after.local.service in SLE12, the service does not start at boot or after boot.
ls-boot:~ # systemctl status after.local   (NOTE: this seems different from
systemctl enable /lib/systemd/system/after-local.service)

after.local.service
   Loaded: loaded (/etc/init.d/after.local)
   Active: failed (Result: exit-code) since Wed 2016-01-06 01:06:07 MST; 7h ago
  Process: 638 ExecStart=/etc/init.d/after.local start (code=exited, status=203/EXEC)

Jan 06 01:06:07 ls-boot systemd[1]: Failed to start after.local.service.
A restart of the service results in the following error:
ls-boot:~ # systemctl restart after.local
Job for after.local.service failed. See "systemctl status after.local.service" and "journalctl -xn" for details.
If you run journalctl and search for after.local, you see the following error:
ls-boot systemd[675]: Failed at step EXEC spawning /etc/init.d/after.local: Exec format error
The content of /etc/init.d/after.local is:
ls-boot:~ # cat /etc/init.d/after.local 
touch /var/log/test.log
Comments