Crontab on AIX

Hi

I'm trying to set up a crontab on AIX and for some reason it's not running my script at the specified time - here's what I have tried so far:

30 14 * * * <scriptname>
35 14 *** /directory/<scriptname>
40,14 *** /directory/<scriptname> (nb crontab won't accept the comma)

1 and 2 look OK when I go "crontab -l", seems to be fine, but my script doesn't run... any ideas? :o

---------- Post updated at 07:57 AM ---------- Previous update was at 07:53 AM ----------

Hmmm seems that whoever set my environment up set it up to be 1hr ahead of the current time, do'h!!! So, I'll try to re-schedule as per the server time and not the PC time.

---------- Post updated at 08:04 AM ---------- Previous update was at 07:57 AM ----------

Alas, it didn't work... any ideas? :slight_smile:

  • did you check executable permission on your script?
30 14 * * * /dir/<scriptname>
  • is it working?

I can run my script at command line with no problems, is that what you mean?

i meant your script is working properly as cron entry in format?
min hour * * * /dir/<scriptname>

try this appropriate date and check your mail and cron log.
and be sure env variables already are set in your script.

Additionally,
1.Use full path mentioning the script location in the cron entry.

30 14 * * * /home/dir1/dir2/<scriptname>

2.Check if you are (your user name) allowed to execute cron job. The sysadmin might have included you in /etc/cron.deny file. which prohibits the user from running a cron job

Cheers for the feedback. I'm working on something else at the moment (hurrah for priorities), but I'll come back to this ASAP, sometime tomorrow.

Thanks again.

---------- Post updated 05-13-11 at 07:58 AM ---------- Previous update was 05-12-11 at 10:46 AM ----------

@ygemici - Yes, I believe it's working in the format you metion, i.e. I can schedule the job by going "crontab <mycrontab>", that's alright. The problem is that when the server hits the time specified in the crontab, the script isn't executed. I'm still new to UNIX so I'll take a look into mail and cron logs.

@michaelrozar17 - I made sure to use the full path, but that seemed to have no effect. The sys admin says I have permissions to run crontab and I haven't received any error messages to suggest otherwise (well, any obvious errors).

Thanks both for the suggestions. :slight_smile:

---------- Post updated at 09:21 AM ---------- Previous update was at 07:58 AM ----------

@ygemici -Score, got something in my mail... 

-- 
 From daemon Fri May 13 15:15:01  2011
 Received: (from daemon@localhost) by  <server>.sun.ctlmcof.fr (AIX5.3/8.13.4/8.11.0) id p4DDF15H4046954 for  <user>; Fri, 13 May 2011 15:15:01 +0200
 Date: Fri, 13 May 2011 15:15:01  +0200
 From:  daemon
 Message-Id:  <201105131315.p4DDF15H4046954@<server>.sun.ctlmcof.fr>
 To:  tallyman
 Subject: Output from cron job  /dir/<script>, <user>@<server>, exit status  126
  
 Cron  Environment:
  SHELL  =
  PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java14/jre/bin:/usr/java14/bin:/usr/java131/jre/bin:/usr/java131/bin
  CRONDIR=/var/spool/cron/crontabs
  ATDIR=/var/spool/cron/atjobs
  LOGNAME=tallyman
  HOME=/apps/<user>
  
 Your "cron" job executed on  <server> on Fri May 13 15:15:00 DFT 2011
 /dir/<script>
  
  
 produced the following  output:
  
 sh: /dir/<script>: cannot  execute
  
  
 *************************************************
 Cron: The previous message is the  standard output
       and standard error of one of  your cron commands.

--

Does this mean anything to you? :slight_smile:

sh: /dir/<script>: cannot execute :wall:Is it what I think it is????

Please post the output od crontab -l from your login. Note, each user has their own cron space

regards,
Ahamed

It seems permission related to me (think someone else said it could be that above).

I'm not at my work PC atm, but the output of crontab -l is...

35 14 *** /directory/<scriptname>

Is it exactly like this? Shouldn't you replace directory and <scriptname> appropriately? That is what the error says or did you edit it to keep it confidential? Sorry if I am mistaken.

regards,
Ahamed

You're right, I had to edit it to keep it confidential (although, no one could really do anything by just knowing the dir and script name I guess...).

Other than <directory> and <scriptname>, the output of crontab -l is exactly

PS anything I have posted in this tread which contains <>, means I have removed something to keep things a bit confidential.

I need to have a chat with the admins, they claim they gave me the correct rights to run crontab but I don't believe them. :slight_smile:

Cheers for your help.

Regards,