Release 1.0.0

This commit is contained in:
arcan1s 2013-12-21 12:09:18 +04:00
parent 8d20e06d09
commit 4ed7bc7f90
4 changed files with 73 additions and 4 deletions

26
PKGBUILD Normal file
View File

@ -0,0 +1,26 @@
# Author: Evgeniy "arcanis" Alexeev <esalexeev@gmail.com>
# Maintainer: Evgeniy "arcanis" Alexeev <esalexeev@gmail.com>
pkgname=queued
pkgver=1.0.0
pkgrel=1
pkgdesc="Daemon for starting jobs to queue of calculations"
arch=('any')
url="https://github.com/arcan1s/queued"
license=("GPL")
makedeps=('git')
source=(https://github.com/arcan1s/queued/releases/download/V.${pkgver}/${pkgname}-${pkgver}.tar.xz)
md5sums=('d93c8cf20804b07b47645b0c43d45d3d')
backup=('etc/queued.conf')
package()
{
# daemon
install -D -m755 "${srcdir}/${pkgname}/usr/bin/queued" "${pkgdir}/usr/bin/queued"
# service
install -D -m644 "${srcdir}/${pkgname}/usr/lib/systemd/system/queued.service" \
"${pkgdir}/usr/lib/systemd/system/queued.service"
install -D -m644 "${srcdir}/${pkgname}/etc/queued.conf" \
"${pkgdir}/etc/queued.conf"
}

View File

@ -1,4 +1,46 @@
queued queued
====== ======
Daemon for starting jobs to queue of calculations Information
-----------
Daemon for starting jobs to queue of calculations. To start deamon just run `systemctl start queued` as root.
help message
------------
queued [ -jd | --jobdir /var/lib/queued/job ] [ --priority 0 ] [ -q | --queuefile /var/lib/queued/queue ] [ -u | --user root ] [ -wd | --workdir /var/lib/queued/work ] [-v | --version ] [ -h | --help ]
Parametrs:
-jd --jobdir PATH - path to job directory. Default is '/var/lib/queued/job'
--priority NUM - defalut priority. Default is '0'
-q --queuefile PATH - path to queue file. Default is '/var/lib/queued/queue'
-u --user USERNAME - start jobs by user. Default is 'root'
-wd --workdir PATH - path to work directory. Default is '/var/lib/queued/work'
-v --version - show version and exit
-h --help - show this help and exit
Configuration
-------------
All settings are stored in `/etc/queued.conf`. After edit them you must restart daemon (`systemctl restart queued`).
How-to run jobs
---------------
* create shell script with the command (it have a name `script.sh` for example)
* create priority file (`script.sh.pr`) with the job priority if it is needed
* create user file (`script.sh.user`) with the job username if it is needed
* copy files to `$WORKDIR`
Instruction
===========
Dependencies
------------
* bash (sed, awk, etc)
* systemd
Installation
------------
* download sources
* copy source to `/`:
sudo cp ../queued/* /

BIN
queued-1.0.0.tar.xz Normal file

Binary file not shown.

View File

@ -120,6 +120,7 @@ cd /
[ -d "$WORKDIR/$FILE" ] && continue [ -d "$WORKDIR/$FILE" ] && continue
FILE_EXT="${FILE##*.}" FILE_EXT="${FILE##*.}"
[ "$FILE_EXT" = "pr" ] && continue [ "$FILE_EXT" = "pr" ] && continue
[ "$FILE_EXT" = "user" ] && continue
[ -e "$QUEUEFILE" ] && grep --quiet "$WORKDIR/$FILE" "$QUEUEFILE" && continue [ -e "$QUEUEFILE" ] && grep --quiet "$WORKDIR/$FILE" "$QUEUEFILE" && continue
echo "[II] Adding file '$FILE' to list" echo "[II] Adding file '$FILE' to list"
if [ -e "$WORKDIR/$FILE".pr ]; then if [ -e "$WORKDIR/$FILE".pr ]; then
@ -168,10 +169,10 @@ cd /
CURJOB=$(tail -1 "$QUEUEFILE" | awk -F "==" '{print $2}') CURJOB=$(tail -1 "$QUEUEFILE" | awk -F "==" '{print $2}')
[ -z "$CURJOB" ] && break [ -z "$CURJOB" ] && break
sed -i '$d' "$QUEUEFILE" sed -i '$d' "$QUEUEFILE"
[ -e "$CURJOB".pr ] && mv "$CURJOB".pr "$JOBDIR/$(basename "$CURJOB")".pr [ -e "$CURJOB".user ] && CUR_USER="$(cat "$CURJOB".user)" || CUR_USER="$STARTASUSER"
mv "$CURJOB" "$JOBDIR/$(basename "$CURJOB")" 2> /dev/null || break mv "$CURJOB"* "$JOBDIR/" 2> /dev/null || break
echo "[II] Running job '$CURJOB'" echo "[II] Running job '$CURJOB'"
su -c "/bin/sh "$JOBDIR/$(basename "$CURJOB")"" $STARTASUSER &> "$JOBDIR/$(basename "$CURJOB")".log & su -c "/bin/sh "$JOBDIR/$(basename "$CURJOB")" &> "$JOBDIR/$(basename "$CURJOB")".log" $CUR_USER &
) )
else else
echo "[II] You have a running job" echo "[II] You have a running job"