Skip to main content
Version: 2.202111.x.x LTS

Custom init scripts

You can write shell scripts which are automatically executed at the startup/shutdown of the server if you store them within the /etc/init.d.custom/ directory. The files are executed in alphabetical order.

The command line argument passed to these scripts is either start (when starting the server) or stop (when shutting down the server). Put your script into the /etc/init.d.custom.first/ directory if you need your script to be executed before starting any Nevis product or component.

The following code block shows you an example of an init script:

/etc/init.d.custom/S80nfs example
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH

case "$1" in
start)
mkdir -p /bkp
systemctl start rpcbind
mount share.zh.adnovum.ch:/vol/backup /bkp
;;
stop)
umount /bkp
;;

*)
echo "Usage: S80nfs {start|stop}"
exit 1
esac

exit 0