#!mkcmd
# $Id: kicker.m,v 1.22 2008/12/13 21:26:54 ksb Exp $
# We have a library of commands we'll kick-off, they live in		(ksb)
# a heirarchy under KICKER_LIB organized by the hour of the day they
# are supposed to be dropped in the batch queue.  This might sound
# like we should use the rescheduling-at-job trick, but that drifts
# and is subject to a fragile setup, sudden rebots are a killer.
#
from '<ctype.h>'
from '<sys/param.h>'
from '<sys/types.h>'
from '<sys/stat.h>'
from '<sysexits.h>'
from '<stdlib.h>'
from '<errno.h>'
from '<fcntl.h>'
from '<unistd.h>'
from '<sys/wait.h>'
from '<time.h>'
from '<pwd.h>'
from '<grp.h>'

require "std_help.m" "std_version.m"
require "std_control.m" "util_errno.m"
require "kicker.mc"

from '"machine.h"'

basename "kicker" ""
%i
static char rcsid[] =
	"$Id: kicker.m,v 1.22 2008/12/13 21:26:54 ksb Exp $";
%%

augment action 'V' {
	user "Version();"
}
char* named "pcGroup" {
	local param "group"
	help "group privileged to spool tasks"
}
action 'B' {
	named "BuildSpool"
	left ["pcGroup"] {
	}
	update "/* at exit */"
	exit {
		update "%rBn(pcGroup);"
	}
	help "to build spool structure, to setup kicker"
}
char* 'S' {
	exclude 'B'
	named "pcOpRule"
	param "mnemonic"
	init "(char *)0"
	help "use an op escalation to change credentials"
}
every {
	named "Inject"
	param "hours"
	help "enqueue all tasks from specified spools"
	exclude 'B'
}

cleanup "Batch((char *)0, (struct stat *)0, (char *)0);"
