Kristy H
1st February 2002, 20:37
I created a session in BaaN that will call a Unix script to run 1 job using rc.startjob. I can make the Unix script write out different things, but it will never start the job. I set the user of the job to myself to see if I could get it to work, but no luck. I'm doing the following command in BaaN.
ret = SHELL("/home/busers/khalbroo/runjob", SHELL_NO_OUTPUT")
The runjob script says to go to the $BSE/etc directory and do rc.startjob jobname. Any ideas why this will not work? I have verified that the script is getting called and that it will excute other commands, but not rc.startjob.
Thanks in advance for any suggestions.
patvdv
1st February 2002, 21:34
Hi Kristy,
The idea is that you use the rc.startjob as a trigger to start your Baan job and not the other way around. Typically you would put this in a UNIX cron entry. Make sure you have the USER variable exported correctly in the rc.startjob file and that is points to a valid user. If you need to create jobs for multiple companies, the easiest then is to create a user for each company and schedule the job from that user's cron file.
Hope it is a bit more clear to you now :)
Kristy H
1st February 2002, 21:37
Our problem is that the user has to run a BaaN session to kick off a job without making them log into Unix. We don't know the time they want this job to run so we cannot schedule the job.
Thanks,
Kristy
patvdv
1st February 2002, 21:46
Kristy,
What you are trying to do might be a bit too complicated to work. Running a job from a script from a script from a session. Though I can't see why your runjob script is not at least trying to execute the rc.startjob. Did you check whether the user has permissions on $BSE/etc?
bhill9
1st February 2002, 21:51
Is there a way you can have the users run the Activate Job, but only have access to the job you want them to activate??
:p Brian
Kristy H
1st February 2002, 21:54
I don't know how I would do that and keep the user to running only the job I want them to have permission for.
patvdv
1st February 2002, 22:00
Kristy,
How about putting a little menu in the user's .profile in which you can specify an option to run the rc.startjob?
NPRao
1st February 2002, 22:02
Maybe you can consider the options of Authorization Templates/Roles.
victor_cleto
1st February 2002, 22:05
What about build a script that is like a scheduler, runs every certain ammount of time and checks for certain flags (in files).
This "scheduler would be running from the root cron and would monitor a specific file for entries.
The user then just runs a script from inside Baan that the only thing it does is to write a "specific" line in the file that the scheduler monitors.
On the next check of the scheduler, the job would be triggered, and the line deleted from the file (to avoid possible repetitions), You could even make sure that the scheduler also creates logs that you can monitor to know who runs what and when.
I think your problem is that if you start something from inside Baan, that must be run using the current user (he is after all, the PPID of the rc.startjob!). By using that trick, it's the root that starts the processes, so they will work properly!
Kristy H
1st February 2002, 22:15
The user does have permission in the $BSE/etc directory.
Thank you all for the great suggestions.
Kristy