Click to See Complete Forum and Search --> : How use Crontab


lubiel2
10-23-2003, 05:57 PM
Hello,


someone knows the way to use crontab ???

I have this example:

[root@132 /]# 57 16 * * * /usr/sbin/wall%ESTO ES UNA PRUEBA%vivian.txt
bash: 57: command not found
[root@132 /]#


whats my error ???


Any help is greatly appreciated.

Hayl
10-23-2003, 06:09 PM
you are just typing in a line of a cron file into the command line. you need to either add it to /etc/crontab or make your own cron file.

lubiel2
10-23-2003, 06:11 PM
would you mind send me a example using my
line please ???

bwkaz
10-23-2003, 06:24 PM
crontab -e

(This ought to fire up an editor, looking at your current crontab file. If this editor is vim, then you need to enter insert mode, using the 'i' key. Then:)

57 16 * * * /usr/sbin/wall%ESTO ES UNA PRUEBA%vivian.txt

(Or something. I'm not sure what that %ESTO ES UNA PRUEBA% stuff is supposed to be, other than "this is a" ... something that I can't translate... ;))

Then hit escape (if you're in vim).

Then:

:wq

and hit enter. You should get a message about your crontab file having been changed.

lubiel2
10-23-2003, 06:40 PM
hello,

I did that, and i can see the output, i dont know if it work ???

"crontab.26505" 1L, 57C written
crontab: installing new crontab
[root@132 /]# date
Thu Oct 23 17:38:24 COT 2003
[root@132 /]# whereis vivian.txt
vivian:
[root@132 /]# find / -name vivian.txt
[root@132 /]#


so, whats happen ???

38 17 * * * /usr/sbin/wall%This is a Test%vivian.txt

lubiel2
10-23-2003, 07:27 PM
I doing crontab successful, but now, i am getting this error,

someone could tell me in which directory I need to give
permisison and waht kind ??? read , write , both ???


/bin/sh: /usr/local/cdr2mysql.pl: /usr/bin/perl
: bad interpreter: Permission denied


please...

bwkaz
10-23-2003, 09:09 PM
The last piece of the crontab line needs to be some valid command. You can't use stuff like echo unless you redirect output (because when the cron job runs, there is no current terminal), but you can do anything else that will work when you type it into the command line.

My guess is that something's wrong with your Perl script, but I don't have a clue what it would be. Maybe if you use something that's not a Perl script (like echo "hi" >/home/username/test.txt), that would work better.