i have a problem with unix

Hi,
> i have a problem using the crontab command. i have a program which
> will show a pop-out in the screen using the say command when the
> program is run. but when i put the program into the crontab command, the
> program works perfectly but it did not show any pop-out on the screen.
> may i know what is the problem here?

> Thank you for any of your advice.

Hi,
> i have a problem using the crontab command. i have a program which
> will show a pop-out in the screen using the say command when the
> program is run. but when i put the program into the crontab command, the
> program works perfectly but it did not show any pop-out on the screen.
> may i know what is the problem here?

> Thank you for any of your advice.

ckng, please do not cross-post. It is against the rules.

I have merged both the threads.

oh,,sorry,, thanks

Hi,

i believe you need to direct the output to somewhere. maybe you can try

          • your command > /dev/null > &1
            not tested though.

err.. it did not work, is there any other solutions???

What do you mean by popout? Is it just printing a line on the output (say, a screen)? If it is just that, then all you have to do is redirect the program's output:

* * * * * your_command > /tmp/yourcommand.outfile 2>&1

If it is some complicated java code or something that pops up a window, you won't be able to do that from cron.

The /tmp/yourcommand.outfile will be overwritten everytime the program runs.

i mean when the crontab had start to run on my program script. When finish running the crontab, it will should be able to pop-out a screen using the say command.

What do you mean by 'pop out the screen'? Is it like a pop-up that we get on the web? If yes, then you can't do that from cron. And its no use doing that from cron either, because all processes in crontab run in the background as scheduled jobs so they don't have a terminal or a screen where they can print output or pop-up windows.

oh,, the pop-out screen, is using the [say] command.

for example

if $a=$b, then
say not equal.
else
say equal
fi

so when the crontab run this script, its will generate a either a [not equal] or [ equal] pop-out screen using the [say] command.

can the crontab work like tt???

The programs that are running from cron don't have a tty associated with the process so there is no "screen" for your script to pop up a message in.

If you don't tell a script where to send output (the > /dev/null in typical lines), output is generally e-mailed to the account that owns the crontab. If you don't add the last bit (2>&1) to the command, anything sent to STDERR will be e-mailed.

Generally, as an admin, I'm either redirecting my crontab output to a log file (for errors) or to a specific output file. For example:

0 * * * * /home/carls/bin/webscan > /home/carls/web/sunscan.html

This will create a webpage that webscan generates and e-mail any errors (STDERR output) to me.

So you really can't have a popup window created from a crontab.

Just write the info to a log file and e-mail it to yourself or to a group if more than one needs to see it.

Oh, and what's the "say" command? The only reference I can find to it is the OS X say command which converts text to audio output. Just curious.

Carl

the say command is something like what is shown in the link, it is the yellow colored box in the center of the screen which show [this is a say command]

so is there any other solutions beside using cron that will run the program at the specified time and after the program run finish it will prompt out the say command?????

Hi,

By using crontab its not possible to pop-up. This is because "$DISPLAY environment variable" in RH9. The environment to pop-up will not be there if no terminal.

oh,, so is there other ways to run the program at specified time and show pop-up???

Hi,

Before pop-up include the below line in the script. So it will work in crontab also.

export DISPLAY=localhost:0.0

hi,
if i use a say command, it is means that i put it like this?

  export DISPLAY=localhost:0.0
  say Hello

or i put it at the end of my script at the very last line???

Hi,

Put "export DISPLAY=localhost:0.0" line in ur script in the begnning only once. It will work.

hi,
isit like tis? this is an example of the program. its file name is [testtest]
[
export DISPLAY=localhost:0.0
#!/bin/sh

a="1"
b="2"
c="3"
d="4"
while true
do
if [ $a = $b ] ; then
echo "$a"
[
if [ $c = $d ] ; then
say "$c"
else
say "$d"
fi
else
say "$b"
fi
done
]

then in the crontab command i put
[
45 13 * * * /usr/asm/sys.2862/testtest > /dev/null 2>&1
]

am i right if i put it in this way??