Problem
Is it necessary to type sync before issuing the haltsys or reboot commands?
Solution
No, it is not necessary to type sync before issuing the haltsys or reboot commands.
The commands haltsys and reboot are shell scripts that are in
the /etc directory. Both of these scripts call sync() from
within the script to flush or write out the buffer cache before
shutting down.Both of the scripts issue sync() twice because the kernel
synchronization will prevent the second sync() from beginning
until the first sync is done. This guarantees that the buffer
cache is written to disk before the file systems are unmounted.* IMPORTANT NOTE *The reboot and haltsys commands halt the system immediately.
This command should only be used in single user mode. If there
are any users logged into the system when the reboot or haltsys
command is given, they are logged out and their work in progress
is lost. In addition, network servers and other programs are
terminated abruptly and could create problems when they are re-
started.It is recommended to use the "shutdown" command to shut a server down, for example:
# shutdown -y -g0 -i6for an immediate reboot.NOTE: In order to determine when a server is shutdown then you can do the
following:Add the following line to the commands, "reboot", "haltsys" and "shutdown" so running of these commands can be logged:
/usr/bin/logger "$0 initiated!"This will write an entry into the "syslog" file.
In addition, you may wish to create a /etc/rc0.d/K00shutdown script to track if an "init 6" was ran:
:
# K00shutdown
echo "Logging Shutdown in syslog!"
/usr/bin/logger "$0 initiated!"For OpenServer, you will also see a record of the shutdown process in /etc/rc0.d/messages.
This implementation is optional as if the syslog is not able to be written too then this might cause delays in the reboot cycle.
An immediate reboot can be initiated with:
# sync
# sync
# uadmin 2 x(Where x is 0 for a shutdown - "The Server has halted and may be..." 1 for an automatic reboot and 2 for a quick shutdown - "Press any key to reboot".
If the 'sync' has not been used then it may mean the filesystems
To determine when a server was started, run "who -b".