1763696 Members
2581 Online
108915 Solutions
New Discussion юеВ

Re: Problem with scripts

 
SOLVED
Go to solution
Alan Casey
Trusted Contributor

Problem with scripts

HI,

When I run commands in scripts they are failing. The same commands (all fully pathed) run without problem if run manually. It seems to be an issue with the environment or something like that.
Anybody any ideas?
7 REPLIES 7
Pete Randall
Outstanding Contributor

Re: Problem with scripts

Alan,

Can you give us an example? Post a script? Is it all scripts? All commands?


Pete

Pete
David_246
Trusted Contributor

Re: Problem with scripts

Start at the first line your scripts with :

#!/bin/ksh

|| or at least the shell you use when executing your scripts.

set -x
might show what it does when you're examinig the script.

tusc /path/to/programm may give you quiet some info too (if you know what it means.

An example of the script and the error output might be handy.

Regs David
@yourservice
Todd McDaniel_1
Honored Contributor

Re: Problem with scripts

You either need to source your user's .profile to get the PATH info and/or use set -x in the top of the script...

That usu fixes most problems with scripts not running where a command line does.
Unix, the other white meat.
Alan Casey
Trusted Contributor

Re: Problem with scripts

Hi Pete,

It's not all scripts, it's specific to scripts associated with FileNET Software, FileNET have said that the problem seems to be UNIX related.

Here is an example if this is any use thanks.

"#!/bin/sh
sleep 30
/fnsw/bin/killfnsw -DAy
touch /tmp/alantag

sleep 60
/fnsw/bin/initfnsw -y stop
sleep 200
/fnsw/bin/killfnsw -DAy
sleep 300
/fnsw/bin/initfnsw -y start"
Graham Cameron_1
Honored Contributor

Re: Problem with scripts

Alan

What errors does the above script produce?
All I can imagine is command not found, or permission denied, or some application level error. Maybe it's looking for an
environment variable which is not being exported to the script>
Do you run it as the same user from a script as you do when running manually?

It would be helpful if you could post sample session output.

-- Graham
Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
Sridhar Bhaskarla
Honored Contributor
Solution

Re: Problem with scripts

Hi Alan,

Onething you could do is to source in your .profile at the beginning of the script. This will fix in case if these commands are looking at any environmental settings.

. $HOME/.profile




-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Alan Casey
Trusted Contributor

Re: Problem with scripts

Thanks Sri,

The .profile entry sorted out the problem. :)