Operating System - HP-UX
1830234 Members
2124 Online
109999 Solutions
New Discussion

MANPATH: Undefined variable.

 
Thamm
Occasional Advisor

MANPATH: Undefined variable.

Hi,
as root user I try to start a script via cron.
In this script a command should be executed by another user. For this case it includes a "su"-command:
su - rvs -c "rm /home/rvs/arcdir/rlrudump.log"

This does not work. I get an error message:
MANPATH: Undefined variable.

If I use this scripts directly (without cron) everything works fine.
What to do?
5 REPLIES 5
Rainer von Bongartz
Honored Contributor

Re: MANPATH: Undefined variable.

Try this

/usr/bin/su - rvs -c "rm /home/rvs/arcdir/rlrudump.log"

Regards
Rainer
He's a real UNIX Man, sitting in his UNIX LAN making all his UNIX plans for nobody ...
Pete Randall
Outstanding Contributor

Re: MANPATH: Undefined variable.

First, since you're root to start with, why do you need to do an su just to remove a log? Second, cron has a very minimal environment set up when it runs scripts. Use full path names or set a PATH variable or source a profile and see if that makes a difference.

HTH,
Pete

Pete
James Beamish-White
Trusted Contributor

Re: MANPATH: Undefined variable.

Hiya,

Try using su - rvs -c "/usr/bin/rm /home/rvs/arcdir/rlrudump.log"

But I agree with the lack of need to su - rvs. You should not need it.

Cheers!
James
GARDENOFEDEN> create light
Daimian Woznick
Trusted Contributor

Re: MANPATH: Undefined variable.

The problem is that the script is looking for the variable MANPATH which is in your environment settings. The reason why it works with your account is because you have this variable set. Can you post the entire script so we can see where this is causing you a problem. If you are not looking at that variable you may be able to place the following command at the beginning of your script:

export MANPATH=/usr/share/man

Hope this helps.
Thamm
Occasional Advisor

Re: MANPATH: Undefined variable.

Hi,
now the problem is fixed:
I changed the first line of my script from
#! /usr/bin/csh
to
#! /usr/bin/sh


Thanks for your help.