There are two answers for this question.
On CentOS 7 systemd is how you can run a service or script on start
You put a .service file under /etc/systemd/system, which can look like this:
; /etc/systemd/system/swift.service
[Unit]
Description=Swift
[Service]
Type=notify
ExecStart=myscript
[Install]
; Runlevel here:
WantedBy=multi-user.target
But actually systemd can be used for mounting devices directly, if this is the intention of your script.
For a (non-rpm-packaged) service you would put the a ".mount" file under /etc/systemd/system, e.g. /etc/systemd/system/var-lib-docker.mount.
You might also want look into auto-mount options of systemd, see references.
In order to load the files, use systemd daemon-reload.
; /etc/systemd/system/var-lib-docker.mount
[Unit]
Description="Mount a volume"
Before=network.service
[Mount]
What=/dev/sdb1
Where=/var/lib/docker
;Options=
There is a lot you can tune, please refer to:
References
- https://www.freedesktop.org/software/systemd/man/systemd.service.html
- https://www.freedesktop.org/software/systemd/man/systemd.mount.html
- https://www.freedesktop.org/software/systemd/man/systemd.automount.html