LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   having trouble getting a crontab to work (https://www.linuxquestions.org/questions/linux-newbie-8/having-trouble-getting-a-crontab-to-work-4175420016/)

mkesling 08-02-2012 12:46 PM

having trouble getting a crontab to work
 
I set up a crontab to run a csh script that performs backups everyday at 2am and it works great.

I am trying to add a second crontab that will run a csh script every minute to see if a file exists in a queue directory. If true the csh script sources the file in the queue to set some variables. then it sources some more csh scripts to run a cad program and process various parts for manufacture. My expectation is that every minute I should see the cad software start processing a job. I dont see this happening.

This is the crontab tasks
1 2 * * * /genesis/sys/scripts/FTG_mkk/auto_backup_from_cron
* * * * * /genesis/sys/scripts/FTG_mkk1/qreader
There are no blank lines at the end. I was concerned about path definition but the first line is executing fine, creating log file entries etc. and the paths are same in script executed by next line. I could add the info from $path for the user and software run to the cron $path but not sure how to do this.

I also tried */1 * * * * instead of * * * * *

I checked the cron log in /var/log and see it executing every minute but I dont see anything happening.

Aug 2 10:31:01 genesis7 crond[9680]: (genesis) CMD (/genesis/sys/scripts/FTG_mkk1/qreader)
Aug 2 10:32:01 genesis7 crond[9692]: (genesis) CMD (/genesis/sys/scripts/FTG_mkk1/qreader)
Aug 2 10:33:01 genesis7 crond[9695]: (genesis) CMD (/genesis/sys/scripts/FTG_mkk1/qreader)
Aug 2 10:34:01 genesis7 crond[9700]: (genesis) CMD (/genesis/sys/scripts/FTG_mkk1/qreader)

The csh script the cron is executing for test purposes contains the 4 lines below.

#!/bin/tcsh
echo cron executed
echo cron executed > /tmp/mkkct
exit

I dont see anything happening. The mkkct file isn't appearing in /tmp
Allm I see are log entries every minute.

Help please

mkesling 08-02-2012 12:53 PM

I forgot to mention I'm using Red Hat 5.0

Also any info on scheduling software for linux that would be more appropriate would be appreciated.

YankeePride13 08-02-2012 12:54 PM

Just to make sure...you are calling:

* * * * * /genesis/sys/scripts/FTG_mkk1/qreader

The script that works is in /genesis/sys/scripts/FTG_mkk, but this one is in /genesis/sys/scripts/FTG_mkk1

is that correct?

If so, what are the permissions/ownership of /genesis/sys/scripts/FTG_mkk1/qreader? What user is the cron running under?

Also to confirm, the */1 is how you have it run every minute.

mkesling 08-02-2012 01:33 PM

The cron was created as one of the users that would normally perform these tasks and all the permissions are set to allow the groups this user belongs to execute privilege. I can run the script logged in as this user fine. Just wont run as crontab. All the files involved are owned by this user and are executable + the group is correctly set as well.

The crontab entry looks like this and the qreader script is in FTGmkk1.
* * * * * /genesis/sys/scripts/FTG_mkk1/qreader

I am using * instead of */1 and the log shows it executing every minute.


All times are GMT -5. The time now is 10:53 PM.