Roeland
10th January 2007, 15:50
At the moment I'm starting a job from the crontab with rc.startjob.
In Baan the period is set at every day.
The job can't start on sunday, so I changed that in the crontab, but in Baan I can't select that.
The problem is that when the job isn't executed on sunday, the next execution date isn't increased and the job will never run again unless I manually increase the next execution date.
I could create a script to set the next execution date, but isn't there a better solution.
Can't I just start the job directly from crontab?
I can do that if I deselect period, but than the job wil be deleted after it's done.
bdittmar
10th January 2007, 16:11
At the moment I'm starting a job from the crontab with rc.startjob.
In Baan the period is set at every day.
The job can't start on sunday, so I changed that in the crontab, but in Baan I can't select that.
The problem is that when the job isn't executed on sunday, the next execution date isn't increased and the job will never run again unless I manually increase the next execution date.
I could create a script to set the next execution date, but isn't there a better solution.
Can't I just start the job directly from crontab?
I can do that if I deselect period, but than the job wil be deleted after it's done.
Hello,
create this job for :
Monday, Tuesday, Wednesday .... with period = 1 week .
So in cronab of your jobuser you will execute :
00 15 * * 1 EXPORT USER=jobuser;sh $BSE/etc/rc.startjob monday
00 15 * * 2 EXPORT USER=jobuser;sh $BSE/etc/rc.startjob tuesday
00 15 * * 3 EXPORT USER=jobuser;sh $BSE/etc/rc.startjob wednesday
and so on.
This takes the execution of the jobs to the defined day, no other execution day has to be set in BaaN.
Regards
Roeland
10th January 2007, 16:49
yes, that is a solution, but I have multiple jobs and where also monitor these jobs with external applications. I prefer another solution.
ecarceller
10th January 2007, 17:30
...I might be missing something.
Your statement:
"...the job will never run again unless I manually increase the next execution date."
is incorrect
Drop the use of job daemons completely
In Baan set up job periods to 1 minute for all your jobs
Do all your scheduling in cron
The only time next execution date and time can mess up your jobs is if they are in the future at the time cron kicks off the job. It will stay in status waiting until the specified next x d&t arrives.
Roeland
10th January 2007, 18:08
Drop the use of job daemons completely
How can I do this? Is this a unix process?
I also read on multiple thread's on this forum that the job should still start when the execution date is passed, but for some reason this isn't the case here.
ecarceller
10th January 2007, 18:46
If you are not aware of job daemons you most likely are not using them.
Job daemons are Baan processes that run in background and start jobs based on the frequency/calendar defined in baan.
They are kicked off using $BSE/etc/rc.startjobdm which at the very bottom runs this:
ba6.1 ttaad5206m000 2>${BSE_TMP}/rc.startjobdmerr &
Search for that tools session name among your OS processes to see if you have one running:
ps -fe|grep ttaad5206m000
I doubt you do.
Roeland
11th January 2007, 09:36
They are kicked off using $BSE/etc/rc.startjobdm which at the very bottom runs this:
ba6.1 ttaad5206m000 2>${BSE_TMP}/rc.startjobdmerr &
No, I'm not using the job daemon then:
ba6.1 ttaad5203m000 2>${BSE_TMP}/rc.startjoberr.1 &
Roeland
11th January 2007, 10:07
I think it works now.
I changed the settings to 1 minute.
The mistake was the enddate. That wasn't changed since '99
Thanks for all the help!
Roeland
15th January 2007, 13:11
Looks like it still doesn't works.
When I run it now (15/1/2007) it won't start.
/baan/bse/etc/rc.startjob.root PROD1 /tmp/job.prod1
screenshot (http://img92.imageshack.us/my.php?image=jobbh1.jpg)
Kozure Ohashi
15th January 2007, 13:28
Please post your script and the directory (permissions).
Regards,
Kozure
Roeland
15th January 2007, 14:56
drwxr-xr-x 2 bsp bsp 1024 Jul 26 2004 .
drwxr-xr-x 28 bsp bsp 512 Jul 26 2004 ..
-rwxr-x--- 1 bsp bsp 1405 Jul 26 2004 rc.startjob.root
#!/bin/ksh
BSE=/baan/bse
BSE_TMP=/baan/bse/tmp
export BSE BSE_TMP
PATH=$BSE/bin:$PATH
export PATH
TERM=vt100 ;export TERM
USER=root100;export USER
if [ $# -lt 1 ];then
echo "Usage : rc.startjob <jobname> [jobok_file]"
exit 1
fi
if [ $1 = "-U" -o $1 = "-u" ];then
echo "Usage : rc.startjob <jobname> [jobok_file]"
exit 1
fi
#jobok_file contains the characters "OK" if the job was successful !
#If jobok_file is not specified, then output is written to $BSE/tmp/job
BAMODE=1 ;export BAMODE
DS_SERVER=ba ;export DS_SERVER
BSH_JOB=$1 ;export BSH_JOB
if [ $# -gt 1 ];then
BSH_JOBOK=$2 ;export BSH_JOBOK
# echo $BSH_JOBOK
fi
ba6.1 ttaad5203m000 2>${BSE_TMP}/rc.startjoberr.1 &
norwim
15th January 2007, 17:09
Hi there,
I guess (from the name root100) that you do the same as we do here, that is to start baanjobs via roots crontab. The job has execution permission for user bsp and group bsp, not for root. Have you tried to change the permissions? I just did a test, although I could execute a shell-script with permissions like yours from prompt, it didn't execute from crontab.
What happens when you call the script with "sh PATH/rc.startjob.root" in crontab?
A job in Baan that has status 'free' should be executed regardless of the entry in field 'next execution date' when started via ttaad5203m000.
Add something like 'date > /home/bsp/did_i_run_or_not' in your rc.startjob.root script to check whether the script was started at all.
Good luck
Norbert
ecarceller
15th January 2007, 17:22
Look for errors or hints on what's going on in these files (check them right after the job's run time)
$BSE/tmp/job
${BSE_TMP}/rc.startjoberr.1
$BSE/log/* (log.ba6.1 and log.bshell might have something)
Also try to send standard output and standard error to files you can review after the run (or run time) in your cron line. Something like this:
0 12 * * 1-6 /usr1/baan/bse/etc/rc.startjob THEJOB > /home/bsp/stdout 2> /home/bsp/stderr
Kozure Ohashi
15th January 2007, 17:49
Looks like wrong permissions.
Even root has no access to your file, i assume it is roots crontab?
Please give r and x rights to others rwx r-x r-x permission and try it.
Hope it helps.
Regards,
Kozure
Roeland
18th January 2007, 09:12
The scripts works fine.
I made a TEST job and let it run every hour from cron. This was running just fine all night.
But yesterday a job failed with the same settings.
/baan/bse/etc/rc.startjob.root FIN /tmp/job.fin 2>&1
produced the following output:
Connecting with bshell...
Connection established.
Wed Jan 17 18:55:03 CET 2007
I just didn't start. (called from cron at 18:55)
Nothing more in the logs.
I have to do some more testing...
Kozure Ohashi
18th January 2007, 10:12
Have you entries within the jobhistory and the messages per job within baan?
(ttaad5411m000 // ttaad5412m000)
Regards,
Kozure
norwim
18th January 2007, 10:35
Hi there,
ok, so you made sure that the unix script was executed.
So the 'bad guy' definitly has to be Baan :-)
You started this thread with a question about scheduling the job differently. So I assume that the job itself (all sessions started in the job) haven't been modified?
You mentioned that the job will be deleted when you unhook 'periodically' - did this happen to you? If yes I have an idea what may have happened:
When you define a job, besides from all the information defined on the job control basis (session per step, next step if an error occurs) you have to enter the values of the input fields on the forms (stored in ttaad503).
Could it be that the started session simply lacks this information?
Its behaviour would be exactly as viewed now ..... start and terminate as there is nothing to do.
Or, just another idea - perhaps the session was started with year.f="2006" and year.t="2006" or something like this?
Have a look at ttadv503 to check.
hth
Norbert