Ask Step create crontab

dear master,

I have a question about crontab,
I trying create a file.

#touch myfile
#vi myfile
  errpt >> reporterror /mydirectory

that content myfile.

and I try, insert at crontab -e

45 14 * * * /myderectory/myfile >> /mydirectory

_________________________________________________

Up command in not execute with crontab.

maybe have any idea master.. ?

regard

Amin

Have you tried this?

45 14 * * * /usr/bin/errpt >> <my directory> 2>&1

Check the syslog to see if cron started the job.

errpt is probably not in cron's PATH.

whereis errpt

Try /absolute/path/to/errpt

that is not work,

errpt is command,

---------- Post updated at 10:27 PM ---------- Previous update was at 08:51 PM ----------

myfile connot be execute with crontab..

this myfile

errpt -a >> error_all

if I execute with command ./myfile its work.

any idea again master?

regard

Explain, please?

To Williamen
"that is not work,
errpt is command,"

Those statements right there are not correct, it works I tried it, what you are doing is appending the errpt o/p to that file everyday at 2:45 PM.

On your script (myfile), have you check the permissions and ownership? change the file permission to 744 (read, write &execute for the owner)

I have tried the below and its working for me

ls -l /tmp/myfile
-rwxr--r--    1 root     system           22 Sep 16 10:17 /tmp/myfile
# cat /tmp/myfile
errpt >> /tmp/err1

I have tried using '-a' flag for errpt as well, and in both cases its appending.

18 10 * * * /tmp/myfile 2>&1
-rw-r--r--    1 root     system        82952 Sep 16 10:18 /tmp/err1

, look at the time stamp on file

cat /tmp/err1
BFE4C025   0901075913 P H sysplanar0     UNDETERMINED ERROR
BFE4C025   0901075813 P H sysplanar0     UNDETERMINED ERROR
BFE4C025   0901075813 P H sysplanar0     UNDETERMINED ERROR
BFE4C025   0901075713 P H sysplanar0     UNDETERMINED ERROR
BFE4C025   0901075713 P H sysplanar0     UNDETERMINED ERROR
BFE4C025   0901075613 P H sysplanar0     UNDETERMINED ERROR
BFE4C025   0901075513 P H sysplanar0     UNDETERMINED ERROR
A6DF45AA   0901074413 I O RMCdaemon      The daemon is started.
BFE4C025   0901074113 P H sysplanar0     UNDETERMINED ERROR
BFE4C025   0901074113 P H sysplanar0     UNDETERMINED ERROR
BFE4C025   0901074113 P H sysplanar0     UNDETERMINED ERROR

I have pasted the partial ouput.

 >> <directory>

apparently tries odd things.
Try

45 14 * * * <my directory>/myfile

and do the >> in myfile

Mr IbmTech.

I trying your command, but not work at my system,

this I trying,

  1. I create file
#pwd
/amin
#touch myfile
#cat myfile
errpt -a >> logerSBX

#ls -l
-rwxr--r--    1 root     system           58 Sep 17 09:16 myfile

I give a permition 744 same with you,

  1. add to crontab
#crontab -e
* * * * * /amin/myfile 2>&1

and I open my directory amin, not have a file

#pwd
/amin
#ls 
myfile

and, I trying execute the myfile,

#./myfile
#ls -l
total 112
-rw-r--r--    1 root     system        50540 Sep 17 09:44 logerSBX
-rwxr--r--    1 root     system           64 Sep 17 09:43 myfile

not have a execute the crontab,

#ps -ef | grep cron
# ps -ef | grep cron
    root 2359532       1   0   Aug 30      -  0:16 /usr/sbin/cron
    root 2490518 2491230   0 09:29:12  pts/4  0:00 vi /tmp/crontabT-aRUa
    root 2949350 3408094   0 15:25:07  pts/4  0:00 crontab -e
    root 3145756 3408094   0 15:24:00  pts/4  0:00 vi /var/adm/cron/at.deny
    root 3539098 2818598   0   Sep 13  pts/1  0:00 vi /tmp/crontabNLa9ya
    root 1835462 2294258   0 09:30:09  pts/4  0:00 vi /tmp/crontabqPa6ia

have a idea again mr ?

regard

You did not followed what I mentioned, you added your own flavor and complaining its messed up, wait a minute, roll back, take a deep breath and look at it again.

I bet, you din't read my post thoroughly.

In the file 'myfile', where are you pointing the logerSBX log file? you are not directing it under /amin, but instead to user's home directory, and you are looking under '/amin' directory, how can you find it?
Secondly, try to go easy, 1st use a specific time for crontab to run the job.
Say you are working on it at 9am, use 9 10 (10 minutes after 9 am) as crontab entry for the job.

dear IBMtech,

I trying your command work,
but use with time at crontab.

Ok, thank you master,

regard

I literally did not understand what you mean by that.

sir,

If I trying your post status work..
and running at /tmp

if I change positions /amin yor command not work.

maybe you can explain me..

regard,

Check to see if '/amin' directory exist? if it does exist make sure you have it at right place (say you want to create '/amin', make sure its under '/' and not under any other sub directory). Also make sure you are point the output to correct location.

Lastly, check the ownership of the directory and its files? If it doesn't belong to you change the ownership.