I believe you will need to use the newer
systemd service on Ubuntu 16.04 rather than the
/etc/init.d. Here you will create a service file to run your script after the
let me present you with a sample of how this would be done.
Create the needed
service file in the
The file would look like this:
Description=Script to run after fstab
ExecStart=/bin/bash -c "/script/to/run.sh"
And of course you will set up the service with:
sudo systemctl start <name_of_service>
sudo systemctl enable <name_of_service>
That would be how it could be done, please I haven't tested it myself, and here is link to documentation to help you further. Please look at other options available for the various fields in the service file.
Note: that the
noauto fstab mount option matters here see
(various mounts and (various swap (various cryptsetup
fsck services...) devices...) devices...) (various low-level (various low-level
| | | services: udevd, API VFS mounts:
v v v tmpfiles, random mqueue, configfs,
local-fs.target swap.target cryptsetup.target seed, sysctl, ...) debugfs, ...)
| | | | |
\__________________|_________________ | ___________________|____________________/
/ | | | \
| | | | |
v v | v v
(various (various | (various rescue.service
| | | v
v v v emergency.target
display- (various system (various system
manager.service services services)
| required for |
| graphical UIs) v
| | multi-user.target
| | |
\_________________ | _________________/
Looking at the diagram above your targets would be
sysinit.target not entirely sure as the latter covers all file systems. So you decide on the phase when your script would run to give you the desired effect.
You can also set a specific mountpoint as a target
foobar.mount. Find your complete list with
systemctl list-units --type=mount.