This just popped into my head. Naïve line-based schedule file using simple
commands together with cron could be real nice.
Creating schedules
--
We should have something like
gump schedule-run --profile=public --official
gump schedule-run --profile=public
gump schedule-run --profile=kaffe
Which writes a file $GUMP_HOME/schedule looking like this
gump run --profile=public --official
gump run --profile=public
gump run --profile=kaffe
The code would be along the lines of
schedule_run()
{
local schedulefile=$GUMP_HOME/schedule
echo gump run $* $schedulefile
}
You would also want to schedule runs immediately
gump schedule-run-first --profile=custom --debug
Which would be something like
schedule_run_first()
{
local schedulefile=$GUMP_HOME/schedule
echo gump run $* $schedulefile.new
cat $schedulefile $schedulefile.new
rm $schedulefile
mv $schedulefile.new $schedulefile
}
And of course there's more options like
schedule_run_when_idle()
{
local pidfile=$GUMP_HOME/pygump/pygump.pid
if [[ ! -f $pidfile ]]; then
schedule_run
fi
}
The next bit is to have calls to those schedule-run commands in the
crontab:
# the next run after midnight will be the official one
0 0 * * * . /home/gump/.bash_profile; gump schedule-run-first \
--profile=public --official
0 6 * * * . /home/gump/.bash_profile; gump schedule-run \
--profile=kaffe
0 12 * * * . /home/gump/.bash_profile; gump schedule-run \
--profile=jdk15
0 3,9,15,18 * * * . /home/gump/.bash_profile; gump schedule-run-when-idle \
--profile=public
Keeping schedules
-
And then have something like
gump try-to-invoke-run
Which checks to see if gump is running, and if not, takes a line from
$GUMP_HOME/schedule and executes it. Along the lines of
try_to_invoke_run()
{
local pidfile=$GUMP_HOME/pygump/pygump.pid
if [[ ! -f $pidfile ]]; then
line=remove_first_line_from_schedule
`$line`
fi
}
And we run that real often from the crontab:
60/12 * * * * . /home/gump/.bash_profile; gump try-to-invoke-run
Why
---
This would ensure gump would be running just about continuously, but you
could also easily interrupt using
gump kill
gump schedule-run-first --profile=custom --debug
To manually change the schedule if you wanted to try something.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]