Changeset 250


Ignore:
Timestamp:
Oct 29, 2009, 4:19:12 PM (11 years ago)
Author:
zerodeux
Message:

Added long options, -v/--version, better help, queue listing command unquoting

Location:
jobq
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • jobq/NEWS

    r249 r250  
     1jobq 0.6
     2
     3    * Added long options
     4    * Added -v|--version
     5    * Documented options in help
     6    * Tidying queue listing (un-quoting command as in queue runner logger)
     7    * (TODO) Added mail output a la cron
     8
    19jobq 0.5
    210
    3         * Better logging, easier to read
    4         * Logging jobqueue size at each job start
     11    * Better logging, easier to read
     12    * Logging jobqueue size at each job start
    513
    614jobq 0.4
    715
    8         * Using $LOGNAME instead of $USER (not set in cron env)
     16    * Using $LOGNAME instead of $USER (not set in cron env)
    917
    1018jobq 0.3
    1119
    12         * Really trapping INT and HUP signals now
    13         * Fix job command unquoting
    14         * Fix indentation, gotta get used to 4 whitespaces
     20    * Really trapping INT and HUP signals now
     21    * Fix job command unquoting
     22    * Fix indentation, gotta get used to 4 whitespaces
    1523
    1624jobq 0.2
    1725
    18         * Fix 'cat: .runner: No such file or directory' error
    19         * Basic security (creating queue dir as user-private)
     26    * Fix 'cat: .runner: No such file or directory' error
     27    * Basic security (creating queue dir as user-private)
    2028
    2129jobq 0.1
    2230
    23         * Initial release
     31    * Initial release
  • jobq/jobq

    r247 r250  
    2121# along with this program.  If not, see <http://www.gnu.org/licenses/>.
    2222
    23 JOBPATH=/tmp/jobq-$LOGNAME
     23PROGRAM=jobq
     24VERSION=0.6-dev
     25
     26# Hardcoded value for now, should fit most people
     27JOBPATH=/tmp/$PROGRAM-$LOGNAME
    2428
    2529
     
    3135        jobt=`stat -c%y $job | cut -d. -f1`
    3236        printf "%5s %20s  " $job "$jobt"
    33         cat $job
     37        sed 's/\\\([^\]\)/\1/g' <$job
    3438    done
    3539}
     
    109113    pid=$!
    110114    echo $pid > $pidfile
    111     echo "queue runner started for '$queue' (pid $pid)" | logger -t jobq
     115    echo "queue runner started for '$queue' (pid $pid)" | logger -t $PROGRAM
    112116}
    113117
    114118help() {
    115119    cat << EOF
    116 Usage:
    117   List queue        : $0 [-q <queue>]
    118   Submit job        : $0 [-q <queue>] command args ...
    119   Start queue runner: $0 [-q <queue>] -d
     120List queue: $PROGRAM [-q <queue>]
     121Submit job: $PROGRAM [-q <queue>] command args ...
    120122
    121123The default queue is called, er, 'default'. One 'queue runner' daemon is
    122124needed per queue, and is started automatically upon first job submission.
     125There is no mechanism to stop a queue runner besides killing it for now.
     126
     127Options:
     128  -d, --daemon       Explicitly start queue runner daemon
     129  -h, --help         Show this help
     130  -q, --queue QUEUE  Select queue (default name is 'default')
     131  -v, --version      Show this software revision
    123132EOF
    124133    exit 1
     134}
     135
     136version() {
     137    echo "$PROGRAM $VERSION"
     138    exit 0
    125139}
    126140
     
    130144while [ $parse_opt != "done"  ] ; do
    131145    case "$1" in
    132         -d) run_daemon;;
    133         -q) shift; queue="$1"; shift;;
    134         -h) help;;
    135         -*) echo "$0: unknown option $1, try -h for help" >&2; exit 2;;
     146        -d|--daemon)  run_daemon;;
     147        -q|--queue)   shift; queue="$1"; shift;;
     148        -h|--help)    help;;
     149        -v|--version) version;;
     150
     151        --) parse_opt=done;;
     152        -*) echo "$PROGRAM: unknown option $1, try -h for help" >&2; exit 2;;
    136153         *) parse_opt=done;;
    137154    esac
Note: See TracChangeset for help on using the changeset viewer.