source: lsb-bootscripts/etc/init.d/template@ f3f65e73

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since f3f65e73 was f3f65e73, checked in by DJ Lucas <dj@…>, 13 years ago

Added stop_on_error parameter to rc.site and cleaned up Begin and End lines.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9552 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 2.2 KB
Line 
1#!/bin/sh
2# Begin $RC_BASE/init.d/template
3
4### BEGIN INIT INFO
5# Provides: template
6# Required-Start:
7# Should-Start:
8# Required-Stop:
9# Should-Stop:
10# Default-Start:
11# Default-Stop:
12# Short-Description:
13# Description:
14# X-LFS-Provided-By:
15### END INIT INFO
16
17# Source the LSB init-functions, ours are pulled in from there.
18. /lib/lsb/init-functions
19
20# These are optional, but required for chk_stat. They will be used in
21# the rest of the functions if defined, else you must provide a program
22# name to control, and a message ('Starting Template Service...'
23# or 'Stoping Template Service...') to evauate_retval. See the
24# documentaion in the lfs-fucntions file for more information.
25MESSAGE="Template Service"
26BIN_FILE="/some/path/to/template"
27CONFIGFILE="/etc/default/template.conf"
28
29# check that $BIN_FILE exists and is executable, and $CONFIGFILE exists.
30chk_stat
31
32# LSB Defined functions require that at least $BIN_FILE be passed to them,
33# where as lfs-functions will use the $BIN_FILE environment variable.
34# loadproc() and endproc() are just wrappers that pass everything on to
35# the LSB defined functions.
36
37case "${1}" in
38 start)
39 #start_daemon "${BIN_FILE}" -arg1 -arg2 #... or:
40 loadproc -arg1 -arg2 -arg3 #...
41 evaluate_retval start
42 ;;
43
44 stop)
45 #killproc -TERM "${BIN_FILE}" or:
46 endproc
47 evaluate_retval stop
48 ;;
49
50 force-reload)
51 reloadproc -force
52 evaluate_retval force-reload
53 ;;
54
55 restart)
56 $0 stop
57 $0 start
58 ;;
59
60 status)
61 statusproc
62 ;;
63
64# reload and try-restart are optional per LSB requirements
65 reload)
66 reloadproc
67 evaluate_retval reload
68 ;;
69
70 try-restart)
71 # Since this is optional there is no lfs-function for this one...
72 # might be at a later time if used enough, but I doubt it usefullness.
73 pidofproc "${BIN_FILE}" > /dev/null
74 if [ "${?}" -ne "0" ]; then
75 MESSAGE="${MESSAGE}: Not Running"
76 else
77 $0 stop
78 $0 start
79 exit 0
80 fi
81 evaluate_retval try-restart
82 ;;
83
84 *)
85 echo "Usage: ${0} {start|stop|{force-}reload|{try-}restart|status}"
86 exit 1
87 ;;
88esac
89
90# End $RC_BASE/init.d/template
Note: See TracBrowser for help on using the repository browser.