aboutsummaryrefslogtreecommitdiff
path: root/cmd2admin.sh
blob: 2d213dbecff1aef9006e4e10bedb8127033bc479 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

if [ "x${1}" != "x" ]; then
  RUN_CMDS="${1}"
else
  send2admin "cmd2admin failed"
fi

if [ "x${2}" != "x" ]; then
  send2admin "${2}"
fi

send2admin "RUN CMD: ${RUN_CMDS}"
OUT=$(bash -c "${RUN_CMDS}")
if [ $? -ne 0 ]; then
  send2admin "CMD failed!"
else
  send2admin "CMD succeeded!"
fi
send2admin "output:\n${OUT}"
exit 0