diff --git a/shellbox b/shellbox index c8f96d3..ab5d5a7 100755 --- a/shellbox +++ b/shellbox @@ -12,12 +12,9 @@ exe=/usr/local/bin/shellbox.tcl prog=shellbox params= conf=/etc/shellbox.conf -confdir=/etc/shellbox.d logdir=/var/log/$prog shells=/var/run/$prog -shopt -s nullglob - [ -n "$logdir" -a -d $logdir ] || mkdir $logdir fail () { @@ -34,7 +31,6 @@ launch () { shift fi temp=$(mktemp -p $(dirname $shells)) || fail "can't create temporary file" - cat $conf $confdir/[0-9]*.conf | \ while read PORT USER DIR COMMAND do # check for empty lines and comments @@ -87,7 +83,7 @@ launch () { echo cat $LOG fi - done + done < $conf mv $temp $shells chmod 0644 $shells } @@ -152,7 +148,6 @@ reload () { temp=$(mktemp -p $(dirname $shells)) || fail "can't create temporary file" while read PID ARGS do - cat $conf $confdir/[0-9]*.conf | \ while read PORT USER DIR COMMAND do if [ "$PORT $USER $DIR $COMMAND" = "$ARGS" ] @@ -161,7 +156,7 @@ reload () { echo "$PID $ARGS" >> $temp continue 2 fi - done + done < $conf stopshell $PID $PORT $ARGS done < $shells mv $temp $shells @@ -179,7 +174,6 @@ status () { shift fi echo -e "pid\tport\tuser\tdir\t\t\tcommand" - cat $conf $confdir/[0-9]*.conf | \ while read PORT USER DIR CMD do # check for empty lines and comments @@ -215,7 +209,7 @@ status () { then grep '\*\*\*\*' $logdir/$PORT 2>/dev/null fi - done + done < $conf } CMD=$1