xctl problem on script
Posted in 2001
mazafar4 had a script using xctl and onstat -u across co-servers that worked interactively but failed under cron. William Rice asked about environment variables and exact errors; the posted script set only INFORMIXSERVER, so Rice guessed INFORMIXDIR (likely /usr/informix) was missing and asked for redirected error output. No confirmation of the fix.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Topics: General Discussion
I have a script which will run across the co-servers with the informix xctl command. The script is running fine at the command prompt; but it fails if i run same when I put it on the crontab. Script: allusers=`/usr/informix/bin/xctl /usr/informix/bin/onstat -u | grep informix | wc -l | awk ' { print $1 }'` echo $allusers Will anyone please help me out. I tried even exporting the xctl command also; but failed. Thanks Sent via Deja.com http://www.deja.com/
Are you sure you are setting all of the environment variables properly in the script?. INFORMIXDIR, and INFORMIXSERVER need to be set. What errors do you get? The exact error output would be quite helpful. Will In article <93cju3$jjj$1@nnrp1.deja.com>, mazafar4@my-deja.com wrote: > I have a script which will run across the co-servers with the informix > xctl command. The script is running fine at the command prompt; but it > fails if i run same when I put it on the crontab. > Script: > allusers=`/usr/informix/bin/xctl /usr/informix/bin/onstat -u | grep > informix | wc -l | awk ' { print $1 }'` > echo $allusers > > Will anyone please help me out. I tried even exporting the xctl command > also; but failed. > > Thanks > > Sent via Deja.com > http://www.deja.com/ > Sent via Deja.com http://www.deja.com/
The complete script is this:
INFORMIXSERVER=tcms; export INFORMIXSERVERtoolsdir=/usr/informix/bin; export toolsdir
allusers=`$toolsdir/xctl $toolsdir/onstat -u | grep informix | wc -l |
awk ' {print $1 }'`
##XCTL="$toolsdir/xctl"; export XCTL
##ONSTAT="$toolsdir/onstat"; export ONSTAT
##allusers=`$XCTL $ONSTAT -u | grep informix | wc -l | awk ' {print
$1 }'`
if [ $allusers -gt 1 ]
then
echo "Informix"
else
echo "Sorry"
fi
In article <93clcp$kr2$1@nnrp1.deja.com>,
William Rice <ricew@operamail.com> wrote:
> Are you sure you are setting all of the environment variables properly
> in the script?. INFORMIXDIR, and INFORMIXSERVER need to be set.
>
> What errors do you get? The exact error output would be quite
helpful.
>
> Will
>
> In article <93cju3$jjj$1@nnrp1.deja.com>,
> mazafar4@my-deja.com wrote:
> > I have a script which will run across the co-servers with the
> informix
> > xctl command. The script is running fine at the command prompt; but
> it
> > fails if i run same when I put it on the crontab.
> > Script:
> > allusers=`/usr/informix/bin/xctl /usr/informix/bin/onstat -u | grep
> > informix | wc -l | awk ' { print $1 }'`
> > echo $allusers
> >
> > Will anyone please help me out. I tried even exporting the xctl
> command
> > also; but failed.
> >
> > Thanks
> >
> > Sent via Deja.com
> > http://www.deja.com/
> >
>
> Sent via Deja.com
> http://www.deja.com/
>
Sent via Deja.com
http://www.deja.com/
INFORMIXDIR is not set, my guess would be it should be set to
/usr/informix.
If this is not the problem, redirect standard error and standard out to
a file, and post what that file contains...
Will
In article <93cmj2$lta$1@nnrp1.deja.com>,
mazafar4@my-deja.com wrote:
> The complete script is this:
> INFORMIXSERVER=tcms; export INFORMIXSERVER> toolsdir=/usr/informix/bin; export toolsdir
> allusers=`$toolsdir/xctl $toolsdir/onstat -u | grep informix | wc -l
|
> awk ' {print $1 }'`
> ##XCTL="$toolsdir/xctl"; export XCTL
> ##ONSTAT="$toolsdir/onstat"; export ONSTAT
> ##allusers=`$XCTL $ONSTAT -u | grep informix | wc -l | awk ' {print
> $1 }'`
> if [ $allusers -gt 1 ]
> then
> echo "Informix"
> else
> echo "Sorry"
> fi
>
> In article <93clcp$kr2$1@nnrp1.deja.com>,
> William Rice <ricew@operamail.com> wrote:
> > Are you sure you are setting all of the environment variables
properly
> > in the script?. INFORMIXDIR, and INFORMIXSERVER need to be set.
> >
> > What errors do you get? The exact error output would be quite
> helpful.
> >
> > Will
> >
> > In article <93cju3$jjj$1@nnrp1.deja.com>,
> > mazafar4@my-deja.com wrote:
> > > I have a script which will run across the co-servers with the
> > informix
> > > xctl command. The script is running fine at the command prompt;
but
> > it
> > > fails if i run same when I put it on the crontab.
> > > Script:
> > > allusers=`/usr/informix/bin/xctl /usr/informix/bin/onstat -u |
grep
> > > informix | wc -l | awk ' { print $1 }'`
> > > echo $allusers
> > >
> > > Will anyone please help me out. I tried even exporting the xctl
> > command
> > > also; but failed.
> > >
> > > Thanks
> > >
> > > Sent via Deja.com
> > > http://www.deja.com/
> > >
> >
> > Sent via Deja.com
> > http://www.deja.com/
> >
>
> Sent via Deja.com
> http://www.deja.com/
>
Sent via Deja.com
http://www.deja.com/