linux - add jobs.log

This commit is contained in:
bunkerity
2021-07-07 13:47:37 +02:00
parent 2c9c9fb62c
commit d03a1a6e3b
2 changed files with 15 additions and 12 deletions

View File

@@ -1,22 +1,22 @@
#!/bin/bash
function do_and_check_cmd() {
if [ "$CHANGE_DIR" != "" ] ; then
cd "$CHANGE_DIR"
fi
if [ "$CHANGE_DIR" != "" ] ; then
cd "$CHANGE_DIR"
fi
if [ "$AS_ROOT" != "" ] ; then
output=$("$@" 2>&1)
else
output=$(su -s "/bin/bash" -c "$1" nginx 2>&1)
output=$(su -s "/bin/bash" -c "$1" nginx 2>&1)
fi
ret="$?"
if [ $ret -ne 0 ] ; then
echo "[!] Error from command : $*"
echo "$output"
exit $ret
fi
echo "$output"
return 0
ret="$?"
if [ $ret -ne 0 ] ; then
echo "[!] Error from command : $*"
echo "$output"
exit $ret
fi
echo "$output"
return 0
}
# Check if we are root