How Cron job open Xterm window and display outputs to this xterm?

How Cron job open Xterm window and display outputs to this xterm?

Post by hvincen » Fri, 14 Mar 2003 02:47:41



Hi,

Please help.  I tried to set up a cron job to:
1.  Open xterm window
2.  Run my script from this xterm
3.  display any errors or output from the script to this xterm.

The reason I need this because the script that I launch from cron job
required user input and it could NOT feed in with regular <<EOF option.

Thanks

--
Posted via http://dbforums.com

 
 
 

How Cron job open Xterm window and display outputs to this xterm?

Post by Richard L. Hamilt » Fri, 14 Mar 2003 08:26:16




Quote:

> Hi,

> Please help.  I tried to set up a cron job to:
> 1.  Open xterm window
> 2.  Run my script from this xterm
> 3.  display any errors or output from the script to this xterm.

> The reason I need this because the script that I launch from cron job
> required user input and it could NOT feed in with regular <<EOF option.

Well, something like:

#! /bin/ksh
MYPATH=/path/to/my/bin/directory:/path/to/my/script/directory
MYCMD="myscript args..."
export PATH="/usr/bin:/usr/X/bin:/usr/openwin/bin:${MYPATH}"
ConsoleXuser="$(who|awk '$2=="console" && $NF=="(:0)" {print $1}')"
if [ "${ConsoleXuser}" = "${LOGNAME}" ]; then
    xterm -display :0 -e ${MYCMD}
else
    print -u 2 -r - \
        "User $LOGNAME not console X user at this time; script not run"
fi

(in another script, itself run from cron) might work.  But if it doesn't
actually require human judgement, but is merely a sticking point of the
program being run that it expects terminal input, scrounge and use
"expect" (www.sunfreeware.com has it precompiled, I think) which uses
pseudo-ttys to communicate with a program and can script its interaction
with that program.  That is, unless the program itself is something that
needs an X display for input, "expect" should be quite able to get around
its inability to deal with <<EOF input.

--


 
 
 

1. Ytree Error opening terminal: xterm.Error opening terminal: xterm.

I installed ytree and got this error message:
Error opening terminal: xterm. Any idea's? The default installation is
linux, with nurses dependency (which I have). I modified the ytree.conf,
then copied it to both /root & /home directories. It failed to run in both
X and shell envirnments, with the same error message. I tried several
global TERM=bla...bla.. with no help.

I still use Xtree under dos and having ytree working would be a great
tool for my limited CLI skills.

TIA..

--
-------------------------------------------------------------------------------
ezrsch                                    __  __     ____  ___       ___ ____

                                        /   / \  / / / / /__ /  \/ /___  /
-------------------------------------------------------------------------------

2. Sound problems

3. xterm, run a process, keep xterm open

4. Iptables and itnernal mail server -> Help

5. xterm: how to open a new xterm and run telnet

6. Metro X & ET4000 = Blotches

7. can you open an xterm & run a subroutine in that xterm?

8. Help Please !!! Websphere adminclient.sh startup problem

9. opening an xterm from cron

10. fixing xterm error: Can't open display