Skip to content

Commit

Permalink
[reboot script] add -h, -? options (sonic-net#484)
Browse files Browse the repository at this point in the history
* [reboot script] add -h, -? and -x options

Signed-off-by: Ying Xie <ying.xie@microsoft.com>

* remove option -x

* add some more help information for reboot script itself

* change some wording/format
  • Loading branch information
yxieca authored Mar 21, 2019
1 parent d51435e commit 8182dfa
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions scripts/reboot
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,33 @@ function clear_warm_boot()
/sbin/kexec -u || /bin/true
}

SCRIPT=$0

function show_help_and_exit()
{
echo "Usage ${SCRIPT} [options]"
echo " Request rebooting the device. Invoke platform-specific tool when available."
echo " This script will shutdown syncd before rebooting."
echo " "
echo " Available options:"
echo " -h, -? : getting this help"

exit 0
}

function parse_options()
{
while getopts "h?" opt; do
case ${opt} in
h|\? )
show_help_and_exit
;;
esac
done
}

parse_options $@

# Exit if not superuser
if [[ "$EUID" -ne 0 ]]; then
echo "This command must be run as root" >&2
Expand Down

0 comments on commit 8182dfa

Please sign in to comment.