1848015 Members
3759 Online
104022 Solutions
New Discussion

CRONJOB - starting RMI

 
Dhiren
New Member

CRONJOB - starting RMI

I am trying to start RMI (remote machine invokation) in a cronjob. If I use following on a command line it works but fails in cronjob

/fin/web/cgi-lawson/rmi/startps.exe

Checked log file under /var/adm/cron but does not return any code.
Peace
8 REPLIES 8
RAC_1
Honored Contributor

Re: CRONJOB - starting RMI

Most of the time, the cron jobs fail because, required environment is not present. cron jobs runs with minimal envoronment unless specified.

Try specifying all required variables. Also, if root has received any email for failed job .

Anil
There is no substitute to HARDWORK
Dhiren
New Member

Re: CRONJOB - starting RMI

Anil:

Thank you for the quick reply. I hope you solve the problem that fast too :-).

As per your instruction I tried

21 14 * * * sh -c ". /fin/law/lawson.env;/fin/web/cgi-lawson/rmi/startps.exe"

no luck. still RMI did not start.

I also checked the mail for root no info there either.

Thanks again.
Peace
Sanjay_6
Honored Contributor

Re: CRONJOB - starting RMI

It is failing since the job probably needs env variables that do not get exported when it is run through cron, but the env variables are used when run through command line.

to mitigate this,

do this,

su - user_name -c "/fin/web/cgi-lawson/rmi/startps.exe"

Hope this helps.

Regds

Sanjay_6
Honored Contributor

Re: CRONJOB - starting RMI

You can also try,

/your_home_dir/.profile;/fin/web/cgi-lawson/rmi/startps.exe


Hope this helps.

Regds
RAC_1
Honored Contributor

Re: CRONJOB - starting RMI

As told by Sanjay, you can make all required envoronments available to your command.

If you do not want that put a script as follows.

#/usr/bin/ksh

export X1="whatever"
export X2="whatever"

Export all variaables like this.
/fin/web/cgi-lawson/rmi/startps.exe

Hope this helps.

Anil
There is no substitute to HARDWORK
Dhiren
New Member

Re: CRONJOB - starting RMI

I have tried this

42 14 * * * sh -c ". /fin/law/lawson.env; cd $CGIDIR/rmi;startps.exe"

still no good. Your help is much appreciated.
Peace
RAC_1
Honored Contributor

Re: CRONJOB - starting RMI

Does /fin/law/lawson.env exports required variables, so that they are available for your command?

As told earlier, try doing it as Sanjay and I told.

Anil
There is no substitute to HARDWORK
Dhiren
New Member

Re: CRONJOB - starting RMI

Thank you all. I will try your suggetion and post the result
Peace