Skip to content

Commit

Permalink
Merge pull request #165 from yellowman/reload-reboot-alias
Browse files Browse the repository at this point in the history
implement a reload reboot  command alias
  • Loading branch information
smytht authored Oct 29, 2024
2 parents b96221e + e7863f1 commit d718c3b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
1 change: 1 addition & 0 deletions commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -2048,6 +2048,7 @@ size_t cmdtab_nitems = nitems(cmdtab);
*/

static Command cmdtab2[] = {
{ "reload", nreboothelp, CMPL0 0, 0, nreboot, 1, 0, 0, 0 },
{ "su", enablehelp, CMPL(ta) (char **)enabletab, sizeof(Menu), enable, 0, 0, 0, 0 },
{ 0, 0, CMPL0 0, 0, 0, 0, 0, 0, 0 }
};
Expand Down
38 changes: 36 additions & 2 deletions nsh.8
Original file line number Diff line number Diff line change
Expand Up @@ -1859,18 +1859,52 @@ Sep 8 15:05:37 tobsd tom: interface drops due to unprotected devices
.El
.Pp
.Tg reboot
.Tg restart
.Tg reload
.Ic reboot
.Pp
Restart the system.
Requires
.Nm
when processing the command will warn the user if there are
unsaved changes to the running-config.
The user will be prompted to confirm the reboot in any case.
The command requires
.Nm
to be in privileged mode and requires root user privileges.
.Bl -dash
.It
E.g. restart the system
.Bd -literal -offset indent
nsh(config-p)/reboot
% Reboot initiated
% WARNING: The running configuration contains unsaved changes!
% The 'show diff-config' command will display unsaved changes.
% The 'write-config' command will save changes to /etc/nshrc.
Proceed with reboot? [yes/no]
.Ed
.El
.Pp
.Tg reboot
.Tg restart
.Tg reload
.Ic reload
.Pp
an alias for the reboot command above.
.Nm
when processing the command will warn the user if there are
unsaved changes to the running-config.
The user will be prompted to confirm the reboot in any case.
The command requires
.Nm
to be in privileged mode and requires root user privileges.
.Bl -dash
.It
E.g. restart the system
.Bd -literal -offset indent
nsh(config-p)/reload
% WARNING: The running configuration contains unsaved changes!
% The 'show diff-config' command will display unsaved changes.
% The 'write-config' command will save changes to /etc/nshrc.
Proceed with reboot? [yes/no]
.Ed
.El
.Pp
Expand Down

0 comments on commit d718c3b

Please sign in to comment.