going crazy with crontab

I’m just tired to fight, can’t start even simple xterm:

crontab -e
0 13 * * * /usr/bin/xterm
just nothing
vi /etc/crontab
0 13 * * * root /usr/bin/xterm
guess what

Have tried with cron reloading, changing of shell and lot of other s… pls help

Won’t work because when the command runs there is no DISPLAY environment. A cron job is not tied to your current environment. When it runs, there could even be nobody logged in on the console.

Hi
cron won’t run a X application like that, it’s meant to run without a
GUI… Please try a simple shell script to test.


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.45-0.1-default
up 2 days 16:14, 3 users, load average: 0.05, 0.14, 0.15
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.53

like that?
0 13 * * * env DISPLAY=:0.0 console --noclose /usr/bin/xterm
nothing happend

toldforc wrote:

>
> I’m just tired to fight, can’t start even simple xterm:
>
> crontab -e
> 0 13 * * * /usr/bin/xterm
> just nothing
> vi /etc/crontab
> 0 13 * * * root /usr/bin/xterm
> guess what
>
> Have tried with cron reloading, changing of shell and lot of other s…
> pls help
>
>
What are you trying to do?

If you’re just trying to sample cron functionality, xterm is NOT a good
example program. First, cron won’t have an X display attached, so you won’t
see anything. Nor is there any way to get input to xterm. Also remember
that the default environment is minimal - no .login/.bashrc is run to set up
$VARIABLEs.

Cron is really meant to run programs independent of any interaction -
cleanup scripts, backups, recovery/logging tasks, etc.

Nearly but catch the output if you’re ever unsure i.e

16 * * * * DISPLAY=:0.0 /usr/bin/xterm &>/tmp/error.out

ok
touch test2
cat > test
#!/bin/sh
rm test2 &2> /var/log/error.out
<ctr+d>
chmod 700 test
crontab -e
0 14 * * * /root/test
then set time to 13:59:30. at 14:00:15 ls showed test2 in /root

Thanks
firstly I was trying to schedule bash script to backup post office twice a day. But I’ve noticed nothing happened. So now, I’m just trynig to schedule anything at all. Forgt about xterm, the sh script above doesn’t works to.

Is the cron service running?

pidof cron

should print a number.

toldforc wrote:

> firstly I was trying to schedule bash script to backup post office
> twice a day. But I’ve noticed nothing happened. So now, I’m just trynig
> to schedule anything at all. Forgt about xterm, the sh script above
> doesn’t works to.

Probably because the test script wasn’t made executable

touch test2
cat > test
#!/bin/sh

ADD THIS HERE -> chmod +x test

rm test2
crontab -e
0 14 * * * /root/test
then set time to 13:59:30. at 14:00:15 ls showed test2 in /root


Kevin Miller
Juneau, Alaska
http://www.alaska.net/~atftb
In a recent poll, seven out of ten hard drives preferred Linux.