HP Visualize J210XC IRIX to HP-UX Migration Guide - Page 13

System Shutdown

Page 13 highlights

System Startup and Shutdown K500inetd K660net Because each script in /sbin/init.d performs both the startup and shutdown functions, each will have two links pointing toward the script from /sbin/rc*.d, one for the start action and one for the stop action. Run Levels and /sbin/rc In previous HP-UX releases, /etc/rc (now /sbin/rc) was run only once. Now it may run several times during the execution of a system, sequencing the execution scripts when moving between run levels. However, only the subsystems configured for execution, through configuration variables in /etc/rc.config.d, are started or stopped when transitioning the run levels. /sbin/rc sequences the startup and shutdown scripts in the appropriate sequencer directories in lexicographical order. Upon transition from a lower to a higher run level, the start scripts for the new run level, and all intermediate levels between the old and new level, are executed. Upon transition from a higher to a lower run level, the kill scripts for the old run level, and all intermediate levels between the old and new level, are executed. When a system is booted to a particular run level, it will execute startup scripts for all run levels up to and including the specified level (except run level 0). For example, if booting to run level 4, /sbin/rc looks at the old run level (S) and the new run level (4) and executes all start scripts in states 1, 2, 3, and 4. Within each level, the start scripts are sorted lexicographically and executed in that order. Each level is sorted and executed separately to ensure that the lower level subsystems are started before the higher level subsystems. Consequently, when shutting down a system, the reverse takes place. The kill scripts are executed in lexicographical order starting at the highest run level and working down, so as to stop the subsystems in the reverse order in which they were started. As mentioned earlier, the numbering is reversed from the startup order. Example If you want cron to start when entering run level 2, you would modify the configuration variable script /etc/rc.config.d/cron to read as follows: # cron config # # CRON=1 to start CRON=1 This would be necessary because the execution script, /sbin/init.d/cron contains the following: # cron startup # . /etc/rc/config if [ $CRON = 1 ] then /usr/sbin/cron fi cron will start at run level 2, because in /sbin/rc2.d a link exists from S730cron to /sbin/init.d/cron. /sbin/rc will invoke /sbin/init.d/cron with a start argument, because the link name starts with an S. System Shutdown To shut down HP-UX for power-off, you can do either of the following: # init 0 or 8

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125

System Startup and Shutdown
8
K500inetd
K660net
Because each script in
/sbin/init.d
performs both the startup and shutdown functions, each will have two
links pointing toward the script from
/sbin/rc*.d,
one for the
start
action and one for the
stop
action.
Run Levels and /sbin/rc
In previous HP-UX releases,
/etc/rc
(now
/sbin/rc
) was run only once. Now it may run several times
during the execution of a system, sequencing the execution scripts when moving between run levels.
However, only the subsystems configured for execution, through configuration variables in
/etc/rc.config.d
, are started or stopped when transitioning the run levels.
/sbin/rc
sequences the startup and shutdown scripts in the appropriate sequencer directories in
lexicographical order. Upon transition from a lower to a higher run level, the
start
scripts for the new run
level, and all intermediate levels between the old and new level, are executed. Upon transition from a
higher to a lower run level, the
kill
scripts for the old run level, and all intermediate levels between the old
and new level, are executed.
When a system is booted to a particular run level, it will execute startup scripts for all run levels up to and
including the specified level (except run level
0
). For example, if booting to run level
4
,
/sbin/rc
looks at
the old run level (
S
) and the new run level (
4
) and executes all start scripts in states
1
,
2
,
3
, and
4
. Within
each level, the
start
scripts are sorted lexicographically and
executed in that order. Each level is sorted and
executed separately to ensure that the lower level subsystems are started before the higher level
subsystems.
Consequently, when shutting down a system, the reverse takes place. The
kill
scripts are executed in
lexicographical order starting at the highest run level and working down, so as to stop the subsystems in the
reverse order in which they were started. As mentioned earlier, the numbering is reversed from the startup
order.
Example
If you want
cron
to start when entering run level
2
, you would modify the configuration variable script
/etc/rc.config.d/cron
to read as follows:
# cron config
#
# CRON=1 to start
CRON=1
This would be necessary because the execution script,
/sbin/init.d/cron
contains the following:
# cron startup
#
. /etc/rc/config
if [ $CRON = 1 ]
then /usr/sbin/cron
fi
cron
will start at run level
2
, because in
/sbin/rc2.d
a link exists from
S730cron
to
/sbin/init.d/cron
.
/sbin/rc
will invoke
/sbin/init.d/cron
with a
start
argument, because the link name starts with an
S
.
System Shutdown
To shut down HP-UX for power-off, you can do either of the following:
# init 0
or