[tutorial] rc.local

Nemesis related tutorials and docs
Forum rules
Please only post tutorials and HOWTOs in here. It should not be a discussion area.
Locked
aus9

[tutorial] rc.local

Post#1 by aus9 » 26 Jan 2016, 23:10

Hi

For those used to /etc/rc.local which acts as a start up script with one or more action lines, Nemesis has some changes due to moving to openrc init system.

Firstly Nemesis has a new 'default' service running called local.

If interested you can see its already running by following command

Code: Select all

    rc-status
    Runlevel: default
     dbus                                                                                                                        [  started  ]
     NetworkManager                                                                                                              [  started  ]
     netmount                                                                                                                    [  started  ]
     syslog-ng                                                                                                                   [  started  ]
     ntpd                                                                                                                        [  started  ]
     acpid                                                                                                                       [  started  ]
     boot-network                                                                                                                [  started  ]
     cgmanager                                                                                                                   [  started  ]
     consolekit                                                                                                                  [  started  ]
     local                                                                                                                       [  started  ]
    Dynamic Runlevel: hotplugged
    Dynamic Runlevel: needed/wanted
    Dynamic Runlevel: manual
Secondly you may find a file called /etc/rc.local in v 3.5 or later .....but its not to be used please.

Instead create on v 3.5 or it may already exist for later editions,
/etc/local.d/zz-start-commands.start
and check that it is executable, if creating it run with root powers

Code: Select all

chmod +x /etc/local.d/zz-start-commands.start
Its contents will be similar to what ever you used for rc.local but the shebang must be
#!/bin/bash

reboot to test your new script

If you are wondering why we chose a filename beginning with zz* its because the openrc local service executes all start files in alphabetical order.
We prefer that all brokenman start files are completed so your "rc.local" stuff comes last on the list.

#############################
Below contents are an example for someone not wanting a non-Nemesis partition mounted
#!/bin/bash
umount /mnt/sda1

Offtopic for shutdown stuff
It follows that if you also want things to happen that system wide or brokenman supplied scripts don't yet have, you will need a shutdown script and I suggest you name it
zz-stop-commands.stop and don't forget to make it executable.

Locked