Upstart integration
Example Upstart job configuration file:
# This file contains a job file for Upstart, enabling the Napatech 3GD Service # (ntservice) to be controlled by Upstart. This includes starting the # ntservice at boot time. # # Upstart is an event-based replacement for the /sbin/init daemon which # handles starting of tasks and services during boot, stopping them during # shutdown and supervising them while the system is running. # # It is recommended to ensure 'LogToSystem = true' is set in the ntservice.ini # file to enable logging with syslog. # # To use this job file file with Upstart, copy this file to /etc/init/ and call # $ initctl reload-configuration # # By default ntservice will be started by Upstart on boot. To use manual start # comment the "start on" option below. # # To start the Napatech 3GD Service call # $ start ntservice # This will not return until the ntservice is operational. # # To stop the Napatech 3GD Service call # $ stop ntservice # # To restart the Napatech 3GD Service after ntservice.ini changes call # $ restart ntservice # # Job file description description "Napatech 3GD Service" # Location where Napatech 3GD Software Suite is installed env NAPATECH3_ROOT=/opt/napatech3 # Start ntservice multi user run levels. Comment this line to use manual start start on runlevel [2345] # Stop ntservice on all other run levels stop on runlevel [016] # Upstart will expect ntservice to call fork exactly once expect fork # Uncomment the following lines to respawn the ntservice up to 10 times within # a 5 second period. If the job exceeds these values, it will be stopped and # marked as failed. # respawn # respawn limit 10 5 # The number of seconds Upstart will wait before killing a process kill timeout 120 # Make sure the low level driver is loaded before starting ntservice pre-start script if [ "`lsmod | grep -c nt3gd`" = "0" ]; then $NAPATECH3_ROOT/bin/ntunload.sh silent $NAPATECH3_ROOT/bin/ntload.sh # On error, tell Upstart not to start the main process for the job if [ $? -ne 0 ]; then exit 1 fi fi end script # Do not return until ntservice is operational post-start script while [ "`pgrep -x ntservice | grep -c ^`" = "2" ]; do sleep 1; done end script # Call ntservice directly as Upstart is not clever to keep track of the # ntservice process ID if ntstart.sh is used. # # By default the file $NAPATECH3_ROOT/config/ntservice.ini is used as # configuration file for the ntservice. exec $NAPATECH3_ROOT/bin/ntservice -d -f $NAPATECH3_ROOT/config/ntservice.ini # Optionally unload the low-level driver on stop #post-stop script # $NAPATECH3_ROOT/bin/ntunload.sh silent #end script