Skip to content

Commit 8182dfa

Browse files
authored
[reboot script] add -h, -? options (sonic-net#484)
* [reboot script] add -h, -? and -x options Signed-off-by: Ying Xie <[email protected]> * remove option -x * add some more help information for reboot script itself * change some wording/format
1 parent d51435e commit 8182dfa

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

scripts/reboot

+27
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,33 @@ function clear_warm_boot()
3030
/sbin/kexec -u || /bin/true
3131
}
3232

33+
SCRIPT=$0
34+
35+
function show_help_and_exit()
36+
{
37+
echo "Usage ${SCRIPT} [options]"
38+
echo " Request rebooting the device. Invoke platform-specific tool when available."
39+
echo " This script will shutdown syncd before rebooting."
40+
echo " "
41+
echo " Available options:"
42+
echo " -h, -? : getting this help"
43+
44+
exit 0
45+
}
46+
47+
function parse_options()
48+
{
49+
while getopts "h?" opt; do
50+
case ${opt} in
51+
h|\? )
52+
show_help_and_exit
53+
;;
54+
esac
55+
done
56+
}
57+
58+
parse_options $@
59+
3360
# Exit if not superuser
3461
if [[ "$EUID" -ne 0 ]]; then
3562
echo "This command must be run as root" >&2

0 commit comments

Comments
 (0)