Debdas Banerjee
8th February 2007, 06:04
Dear frinends,
I want to run a job from my program script ( rc.start jobname). Previously I run shell script from my program script. This time it is not activated my job.
I am giving my code below
We are using Unix as OS.
path.f = "/usr4/baan4/bse/etc/"
cmd = sprintf$("sh %src.startjob %s", path.f,jobs.t)
jobrun = shell(cmd,0)
mark_h
8th February 2007, 16:27
If you start a shell manually and type in the command does it work? Typically I do not use sh in any of my UNIX commands when I shell out, just the command itself - I do not think that is the problem. Are you getting any errors or messages? Can you set it so you see what happens(use 128 or SHELL_MWINDOW). It might give you the info you need to fix the problem.
Debdas Banerjee
9th February 2007, 11:16
Hi Mark_h,
Thanks for reply.
This Shell commands works if I give it in command prompt.
I am giving a exmple below which I used in my session and it is working.
cmd = sprintf$("/bin/login02.sh %s",LOGNAME$)
out = shell(cmd,0)
if out <> 0 then
message("Serious Error !!")
endif
I have tried your option also but nothing has come out.
path.f = "/usr4/baan4/bse/etc/"
cmd = sprintf$("sh %src.startjob %s", path.f,jobs.t)
jobrun = shell(cmd,SHELL_MWINDOW)
mark_h
9th February 2007, 14:38
You did not get an error message or something with jobrun = shell(cmd,SHELL_MWINDOW) this command? I do not know enough about the shell(or UNIX) level to see a problem. I am wondering if the sh command is not the full shell and all the variables are not set for the rc.startjob to work. What does login02.sh look like? Does it set any environment variables or anything like that?
Debdas Banerjee
9th February 2007, 16:27
hI,
I am not getting any error message. Nothing showing any message.
login2.sh is one more shell script.
mark_h
9th February 2007, 17:32
Try this cmd = sprintf$("%src.startjob %s", path.f,jobs.t) and see if you get an error. I am wondering if the second sh command is maybe preventing you from seeing the error.
Debdas Banerjee
10th February 2007, 06:13
Hi,
Thanks again for replying.
I have tried this also , there is no error message.
funny part is jobrunis returns 0 value.
0 means command has executed.
I have logged a case in SSA/INFOR , they are also not saying anything.
It seems I have to give up this option.
exm:
path.f = "/usr4/baan4/bse/etc/"
cmd = sprintf$("%src.startjob %s", path.f,jobs.t)
jobrun = shell(cmd,0)
mark_h
12th February 2007, 14:18
Sorry I am not much help. This should work and I do not know what I am missing. You may have to wait for the support center, unless someone else on the board can think of something.
george7a
12th February 2007, 15:31
Hi,
Are you able to run any other simple UNIX scripts from within your Baan script?
Does the (UNIX) user you are logged in Baan have an "execute" permission to run the job script?
- George
günther
12th February 2007, 15:48
I would do the following:
1. Start a simple shell script from within baan, say "/tmp/test.sh".
2. In that shell script, log anything you can think of, e.g.
#!/bin/sh
JOB=$1
(
echo "*** environment"
env
echo "*** user id"
id
echo "*** current directory"
pwd
# ... maybe something more
echo "*** now starting JOB $JOB ..."
$BSE/etc/rc.startjob $JOB
rc=$?
echo "rc.startjob returned $rc"
) >/tmp/test.out 2>&1
exit 0 # reasonable return code for baan
Hitesh Shah
14th February 2007, 17:34
Are execute permission available for user running the job in script . Status 0 means script is executed but with an error written in script . Also it could be issue of different shell (sh,ksh, csh etc) , different OS variables (e.g BSE , BSE_TMP , $HOME etc). Step-by-step suggested by Gunther is the best approach .
mark_h
15th February 2007, 15:45
I think you all are mis-understanding. Deb can already run a shell script. What is wanted is to replace the script with rc.startjob. It appears there is a problem with that.
Kozure Ohashi
15th February 2007, 17:10
Dear Debdas,
just for testing, can you call the rc.startjob without parameters as one complete string:
e.g. for job25:
ret = shell("/usr4/baan4/bse/etc/rc.startjob job25", 0)
If this not works, i think (but maybe i am wrong) you are running the shell script and the baan script with different users. (shell = root // baan = bsp)
Try this:
ret = shell("touch /usr4/baan4/bse/etc/my.testfile", 0)
Now you can check the user / group / permissions of the user running the command from BaaN in Unix.
On our Unix System the rc.startjob has only priviliges for bsp:
rwxr_x___ bsp bsp rc.startjob
It is called on unix level with crontab.
Regards,
Kozure