diff options
author | davidovski <david@davidovski.xyz> | 2022-03-29 23:36:22 +0100 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-03-29 23:36:22 +0100 |
commit | df88860947686a5e6507fc5d60ff33eac1158c6b (patch) | |
tree | d1dc7f2f003b08afb6d45f7170d7a0dd353060d3 /xi/init.d/template | |
parent | 33d239ecb3d66db2b005afbe68a7029c3f2d2ee0 (diff) |
Diffstat (limited to 'xi/init.d/template')
-rw-r--r-- | xi/init.d/template | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/xi/init.d/template b/xi/init.d/template new file mode 100644 index 0000000..0a7872d --- /dev/null +++ b/xi/init.d/template @@ -0,0 +1,69 @@ +#!/bin/sh +######################################################################## +# Begin scriptname +# +# Description : +# +# Authors : +# +# Version : LFS x.x +# +# Notes : +# +######################################################################## + +### BEGIN INIT INFO +# Provides: template +# Required-Start: +# Should-Start: +# Required-Stop: +# Should-Stop: +# Default-Start: +# Default-Stop: +# Short-Description: +# Description: +# X-LFS-Provided-By: +### END INIT INFO + +. /lib/lsb/init-functions + +case "${1}" in + start) + log_info_msg "Starting..." + # if it is possible to use start_daemon + start_daemon fully_qualified_path + # if it is not possible to use start_daemon + # (command to start the daemon is not simple enough) + if ! pidofproc daemon_name_as_reported_by_ps >/dev/null; then + command_to_start_the_service + fi + evaluate_retval + ;; + + stop) + log_info_msg "Stopping..." + # if it is possible to use killproc + killproc fully_qualified_path + # if it is not possible to use killproc + # (the daemon shoudn't be stopped by killing it) + if pidofproc daemon_name_as_reported_by_ps >/dev/null; then + command_to_stop_the_service + fi + evaluate_retval + ;; + + restart) + ${0} stop + sleep 1 + ${0} start + ;; + + *) + echo "Usage: ${0} {start|stop|restart}" + exit 1 + ;; +esac + +exit 0 + +# End scriptname |