summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkx <kx@radix.pro>2022-09-28 19:18:07 +0300
committerkx <kx@radix.pro>2022-09-28 19:18:07 +0300
commit13ea0c85cfe0c7b9880d5ddf2abe6409cedf9f22 (patch)
tree7f16c61750ef4e79866c1e89394cd925f62cc873
parente395700cd3900e8d91a6e2bbc09f5e9b24437d30 (diff)
downloadsila-shell-13ea0c85cfe0c7b9880d5ddf2abe6409cedf9f22.tar.xz
Poweroff command for admin user
-rw-r--r--src/main.c1
-rw-r--r--src/shell.c9
-rw-r--r--src/shell.h1
3 files changed, 11 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index d00230e..19474de 100644
--- a/src/main.c
+++ b/src/main.c
@@ -71,6 +71,7 @@ COMMAND shell_admin_list[] = {
{ "stat", com_stat, "Print out statistics on FILE" },
{ "more", com_more, "View the contents of FILE" },
{ "vi", com_vi, "Edit the contents of text FILE" },
+ { "poweroff", com_poweroff, "Turn off the BMC power" },
{ "..", com_top, "Return to top menu" },
{ (char *)NULL, (rl_icpfunc_t *)NULL, (char *)NULL }
};
diff --git a/src/shell.c b/src/shell.c
index ade4d53..c5b8332 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -150,3 +150,12 @@ int com_ping( char *arg )
sprintf( syscom, "ping %s", arg );
return( system( syscom ) );
}
+
+int com_poweroff( char *arg )
+{
+ if( !arg )
+ arg = "";
+
+ sprintf( syscom, "poweroff %s", arg );
+ return( system( syscom ) );
+}
diff --git a/src/shell.h b/src/shell.h
index 15b4278..c43f8bb 100644
--- a/src/shell.h
+++ b/src/shell.h
@@ -18,6 +18,7 @@ extern int com_delete( char *arg );
extern int com_cd( char *arg );
extern int com_ping( char *arg );
extern int com_pwd( char *ignore );
+extern int com_poweroff( char *arg );