priyanko
28th October 2009, 16:56
Dear Baan Tool Experts,
I want to invoke a baan session job tdind0278m000, through job daemon.
The requirement is such that this session has to be run everyday at midnight, it takes approximately 6 hours to complete as it update costing of customized items.
i dont want any manual intervention to start this job i.e I don't want to activate this job from baan session " activate job"
What i tried so far is maintain the job, set the periodic time, and keep the status as free.
Now in the bash shell prompt , I started the job daemon by entering the command " rc.startjbdm". The path $bse/etc. The job daemon starts, but it doesn't invoke the job which has a free status in the maintain job session.
Please guide me to run the job in the background everyday in the stipulated time as mentioned above. Also mention the setup and steps involve in it.
thanks in advance to all the baan gurus.
Regards
Priyanko.
norwim
28th October 2009, 18:02
Hi there,
we usually start jobs directly from cron, as usage of job daemon often is a bit confusing.
What I remember is that
a) the job has to have status "in queue" and
b) the projected starting time may not lay in the past
to ensure that the job will be started by the daemon.
Especially b) often caused that jobs weren't started and never would be once a mistake was made - this led to a lot of manual intervention.
If you call a job directly via rc.startjob, it will be executed if the status is "free" and the planned execution date is not taken into account.
hth
Norbert
priyanko
28th October 2009, 18:49
Dear norbert,
Initially I tried by putting status "in queue" , and then started the job daemon it didnt work out.
The point b) is always taken into consideration. the projected starting time is never in the past.
The job daemon is started, after the projected start time is set, which is always in the future.
I have checked the field for periodic. The start time is always rolled over to the next day, once it is executed by activate job session.
I want to imply the same thing without manual internvention to activate the job. The next execution day should always be rolled over.
I am confused with the rc.startjob. One more important point to specify is that the planned execution date and time has to be taken into consideration as this session job should start at mid night, when no transaction or user is logged in.
So even if i call the job with rc.startjob say at 6:00 in the evening, it should only start at the planned time.
currently the requirement is fulfilled by the session "activate job". It starts the job in the planned execution time. This keeps the current bshell of baan active until the job is completed, which requires a client system to be switched on the whole time.
Please guide me more on the same.
I really appreciate the help incurred.
Regards
Priyanko.
norwim
29th October 2009, 17:08
Hello priyanko,
Initially I tried by putting status "in queue" , and then started the job daemon it didnt work out.
As I don't have access to a system atm, I can't look at the rc.startjobd script and only rely on my memory.
IIRC the environment variable USER has to be set in the rc.startjobd script (this specifies the company or more important the PVRC to be used) - if this Baanuser has a different PVRC than the company the session is supposed to run in it won't work.
But again: why don't you start the job via rc.startjob directly? Simply copy the script, enter the appropriate USER and JOB values, export these variables and call your script via crontab - day of week and time set to * and 23 59 will start the session every day one minute before midnight. If my memory is correct, the TERM variable had to be set as well, but this was Baan IV and might be different/obsolete in LN.
good luck
Norbert
bdittmar
29th October 2009, 17:44
Dear norbert,
Initially I tried by putting status "in queue" , and then started the job daemon it didnt work out.
The point b) is always taken into consideration. the projected starting time is never in the past.
The job daemon is started, after the projected start time is set, which is always in the future.
I have checked the field for periodic. The start time is always rolled over to the next day, once it is executed by activate job session.
I want to imply the same thing without manual internvention to activate the job. The next execution day should always be rolled over.
I am confused with the rc.startjob. One more important point to specify is that the planned execution date and time has to be taken into consideration as this session job should start at mid night, when no transaction or user is logged in.
So even if i call the job with rc.startjob say at 6:00 in the evening, it should only start at the planned time.
currently the requirement is fulfilled by the session "activate job". It starts the job in the planned execution time. This keeps the current bshell of baan active until the job is completed, which requires a client system to be switched on the whole time.
Please guide me more on the same.
I really appreciate the help incurred.
Regards
Priyanko.
Hello,
as Norbert said:
Job for every FRIDAY :
Entry in crontab of the jobuser:
35 00 * * 5 export USER=jobs4c;sh /daten/bse/etc/rc.startjob FR1
At 35 Minutes after midnight it's started, the job in BaaN is set to 00:40 (40 minutes after midnight).
So it is set for every day an it works since > 10 Years without problems !
Regards
priyanko
3rd November 2009, 07:47
Dear Nobert.
I am printing the script of the rc.startjobdm
BSE=/baan4/bse
BSE_TMP=/baan4/bse/tmp
export BSE BSE_TMP
PATH=$BSE/bin:$PATH
export PATH
PLATFORM=`uname`
if [ ${PLATFORM} = "Linux" ]
then
ECHO="echo -e"
else
ECHO="echo"
fi
# It turned out that the TERM variable could be unset when running in a cron
#TERM=vt100 ;export TERM
# If you want to use several companies you can create several users for e.g.
# root who probably is running this script. If so, copy this script and use
# the next line to define the USER variable (<root100> is just an example).
#USER=<root100> ;export USER
BAMODE=1
export BAMODE
if [ ${#} -eq "1" ];then
if [ $1 = "-u" -o $1 = "-U" ];then
${ECHO} "Use : rc.startjobdm [-debug]\n"
exit
fi
if [ $1 = "-DEBUG" -o $1 = "-debug" ];then
unset BAMODE
fi
fi
DS_SERVER=ba
export DS_SERVER
if [ ${#} -eq "1" ];then
if [ $1 = "-DEBUG" -o $1 = "-debug" ];then
ba6.1 ttaad5206m000 2>${BSE_TMP}/rc.startjobdmerr
else
ba6.1 ttaad5206m000 2>${BSE_TMP}/rc.startjobdmerr &
fi
else
ba6.1 ttaad5206m000 2>${BSE_TMP}/rc.startjobdmerr &
fi
In the above script , do i have to mention the user name which created the job. where do i mention the user name.
The job is created by the user "bsp"
The bsp user cant start a job daemon though , permission is not there for user bsp, but i can start a job daemon by user named "root".
Please guide me regarding setting up the enviornment variable of user in the script and also if other info has to be maintained.
Regards
Priyanko.
jclju1
3rd November 2009, 16:06
You have to change line #USER=<root100> ;export USER into USER=root100 ;export USER User root100 must exists in application, must be root on OS level and must be placed in right company.