diff --git a/dlinux b/dlinux index 8910404..bd6fbc6 100755 --- a/dlinux +++ b/dlinux @@ -21,8 +21,8 @@ $0 stats - Get your container memory usage statistics $0 time - Get your container expiration time $0 rootpass - Reset root user password $0 key-time - Get your api key expiration time -$0 exec - Execute a command in your container -$0 notify - Send a message DM to your discord +$0 exec [--user user] [--pwd directory] --cmd command - Execute a command in your container +$0 notify - Send a message DM to your discord " } @@ -97,14 +97,20 @@ command_key-time() { command_exec() { while test $# -gt 0; do case $1 in + --user|-u) user=$2; shift ;; --pwd|-p) pwd=$2; shift ;; --cmd|-c) cmd=$2; shift ;; esac shift done + user=${user:-"root"} pwd=${pwd:-"/"} + if ! test $user == "root"; then + cmd="runuser -u $user -- $cmd" + fi + call_api POST exec "{\"pwd\":\"$pwd\",\"cmd\":\"$cmd\"}" | jq -r .stdout }