LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   AIX (http://www.linuxquestions.org/questions/aix-43/)
-   -   CRON not working ; any other way to schedule a script ? (http://www.linuxquestions.org/questions/aix-43/cron-not-working-%3B-any-other-way-to-schedule-a-script-935404/)

arjundey 03-20-2012 02:04 AM

CRON not working ; any other way to schedule a script ?
 
Hi,

I'm using AIX Version 6.1

I had setup a CRON to run a particular script daily at 23:05, but unfortunately its not running from CRON.

Is there any other way to schedule a script to run daily at 23:05 (System Time) like using an indefinite loop and sleep command in existing script and running it in background ?

If yes, can you please provide me the code snipet of the same as I am unable to figure out what exactly needs to be put in.

Looking forward to a quick response.

Thanks in advance.

ac_kumar 03-20-2012 02:55 AM

How are you scheduling job in cron ?
Can you shouw the output of #crontab -e.

EricTRA 03-20-2012 02:58 AM

Hello,

I'd look first into why cron isn't working for your script. Are the permissions on the script set correctly? Are you using full path to your script in the cron definition? Does your script work if executed manually as the user intended to run the script? The best option to run a script automatically is by using cron in my opinion, so troubleshoot that first would be my advice.

Kind regards,

Eric

jimtony 03-20-2012 03:05 AM

How did you configure CRON?
Use crontab -e is OK.

* * * * * command
minute hour day month week

arjundey 03-20-2012 03:28 AM

This is the crontab -e entry : 5 23 * * * /var/mqm/tmp/pso/ftp_cron.sh

chmod 777 permission is given to the script.

I had raised a ticket with IBM & they said that there is some issue with OS & some patching needs to be done to overcome this.
So, basically CRON won't work, no matter what.

Hence, how do I schedule a job without using CRON ?

EricTRA 03-20-2012 03:36 AM

Hi,

Very strange that cron wouldn't work no matter what but if the guys from IBM said that...

You could look into the 'at' command to 'pre-program' a job to run. But you'll need to find a way (scripting for example) to automate it since that's not possible with standard 'at' command.

Kind regards,

Eric

arjundey 03-20-2012 03:39 AM

I'm fairly new to unix shell scripting.
Can you please provide me an example of the code you are suggesting ?

jimtony 03-20-2012 03:53 AM

Use "man at" command to see how to use at.
Or google at.

Lexus45 03-20-2012 04:25 AM

Have you tried running the script manually, without cron ?

arjundey 03-20-2012 05:09 AM

Yes, it is working perfectly when run manually.
There is a OS problem with CRON, as confirmed by IBM. So, there is no problem with the script or the CRON command as such.

Is there anyother way to schedule it by adding a loop or something in the script & running it in background ?

EricTRA 03-20-2012 07:32 AM

Quote:

Originally Posted by arjundey (Post 4631272)
I'm fairly new to unix shell scripting.
Can you please provide me an example of the code you are suggesting ?

Hi,

No, I cannot provide a 'custom made' example since I don't use 'at' to plan tasks. You'll have to look at the manpage as suggested.

Kind regards,

Eric

ac_kumar 03-21-2012 12:23 AM

You can run a script at statup also by adding it in /etc/initab/.
If it suits your condition.

arjundey 03-21-2012 02:32 AM

@ac_kumar - Yes, that could be done, but basically I need it to run at 23:05 daily. How to do that ?

ac_kumar 03-21-2012 02:55 AM

Quote:

Originally Posted by arjundey (Post 4632239)
@ac_kumar - Yes, that could be done, but basically I need it to run at 23:05 daily. How to do that ?

You can make a startup script which contains at commands to run:-

http://www.brunolinux.com/02-The_Ter...t_Command.html

arjundey 03-21-2012 03:34 AM

This was indeed helpful ac_kumar. Thanks a ton !

This thread is now resolved.

Thanks all for your time & valuable inputs. Cheers !!!


All times are GMT -5. The time now is 06:29 PM.