public class CronService extends JVMService
It should be configured like a cron job via the normal text file that is specified via the property keyword CronService.CronTable.
The periodical time of execution is given by 5 fields separated by white spaces. The command is appended in the same tesxt line.
Comment lines are leaded by one of these characters #;$&%
A possible parameter string is:
0,30 17 * * 1-5 to your job
At every day from Monday to Friday (1-5) at 17:00 and 17:30 every week in the year.
59 23 * * 6 to your job
At every Saturday in the week at 23:59.
Property Keyword | Datatype | Default | Description |
---|---|---|---|
CronService.TableFile | File | $SYSTEM_ROOT/cron.tab | The name of the cron table file. |
CronService.Debug | boolean | false | Set this to true to get verbose output. |
Modifier and Type | Class and Description |
---|---|
protected class |
CronService.Job |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COMMENT |
protected boolean |
debug |
protected CronService.Job[] |
jobs |
protected javax.swing.event.EventListenerList |
listeners |
protected java.util.Properties |
properties |
protected static java.util.Map<java.lang.String,java.lang.String> |
RESERVED |
static java.lang.String |
version |
appThread, CONTROLS_PARAMCHANGE, CONTROLS_PAUSABLE, CONTROLS_SHUTDOWN, CONTROLS_STOPPABLE, ERR_OUT, STD_OUT, WAIT_HINT
Constructor and Description |
---|
CronService()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected int[] |
analize(java.lang.String value,
int min,
int max) |
protected CronService.Job |
createJob(java.lang.String line,
java.lang.String[] arr)
Create a job from line.
|
java.lang.String |
getVersion() |
int |
getWaitHint()
Get the time in milliseconds in that is needed for application to stop.
|
void |
init(java.lang.String[] param)
Set the application parameters.
|
void |
jobTerminated(CronService.Job job) |
static void |
main(java.lang.String[] args) |
protected int[] |
normalize(int[] values,
int min,
int max) |
void |
pause()
Pause the FileServerService thread.
|
protected CronService.Job[] |
readTableFile(java.io.File cronTabFile)
Read the cron table.
|
void |
restart()
Restart the FileServerService thread.
|
void |
resume()
Resume the FileServerService thread.
|
void |
setEnvironment(java.lang.String key,
java.lang.String value)
Set environment variables.
|
void |
start()
Start the application.
|
void |
stop()
Stop the FileServerService thread.
|
errOut, errOut, getCallingClassName, getLogLevel, getLogType, requestStopService, sendServiceRunning, setControlsAccepted, stdOut, stdOut
public static final java.lang.String COMMENT
protected static final java.util.Map<java.lang.String,java.lang.String> RESERVED
public static final java.lang.String version
protected CronService.Job[] jobs
protected boolean debug
protected java.util.Properties properties
protected javax.swing.event.EventListenerList listeners
public java.lang.String getVersion()
getVersion
in class JVMService
public void setEnvironment(java.lang.String key, java.lang.String value)
setEnvironment
in class JVMService
key
- The name of the variable.value
- The value of the variable.public void init(java.lang.String[] param)
init
in class JVMService
param
- The array containig the parameter strings.protected CronService.Job[] readTableFile(java.io.File cronTabFile) throws java.io.FileNotFoundException, java.io.IOException
cronTabFile
- The table file.java.io.FileNotFoundException
- If the file is not available.java.io.IOException
- If an read error occurs.public void jobTerminated(CronService.Job job)
protected CronService.Job createJob(java.lang.String line, java.lang.String[] arr)
line
- The text line.arr
- the line splitted at pattern \s*protected int[] analize(java.lang.String value, int min, int max)
protected int[] normalize(int[] values, int min, int max)
public void start()
start
in class JVMService
public void stop()
stop
in class JVMService
public void restart()
public void pause()
pause
in class JVMService
public void resume()
resume
in class JVMService
public int getWaitHint()
getWaitHint
in class JVMService
public static void main(java.lang.String[] args)