Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-12-2012
Registered User
 
Join Date: Jun 2012
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Facing issues while running a cronjob !

Hi,

I am trying to run a cronjob. But while doing so I am getting the following error message :-



Code:
can't open yourfile in /var/spool/cron/crontabs directory.
No such file or directory


How can I resolve this issue ?

Please help.

Thanks
Moderator's Comments:
Please view this code tag video for how to use code tags when posting code and data.
Sponsored Links
    #2  
Old 07-12-2012
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
 
Join Date: Sep 2005
Location: Switzerland - GE
Posts: 4,633
Thanks: 118
Thanked 256 Times in 245 Posts
Well the error messgae suggests it is not there...
Did you look inside /var/spool/cron/crontabs directory?

How did you load your job scheduling?
Sponsored Links
    #3  
Old 07-12-2012
Registered User
 
Join Date: Jun 2012
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
hi,

Thanks for prompt reply !

When I am trying to access the path. The below message is shown :-


Code:
 
ABC@XXX:/var/spool/cron# cd crontabs
ksh: crontabs: permission denied

I tried to load the job scheduling from this ABC user account.

Does it means that this user can't do the job scheduling ?

Should I try to do the job scheduling from root/admin account ?

Please suggest !
    #4  
Old 07-12-2012
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
 
Join Date: Sep 2005
Location: Switzerland - GE
Posts: 4,633
Thanks: 118
Thanked 256 Times in 245 Posts
/var/spool/cron/crontabs is often only accessible to root but not always :

Code:
zra:/var/spool/cron $ ll
total 8
dr-xr-xr-x   5 bin        bin           1024 Oct  4  2011 .
dr-xr-xr-x  15 bin        bin           1024 Jun 11  2002 ..
dr-xr-xr-x   2 bin        bin             96 Oct  4  2011 atjobs
-r--r--r--   1 bin        bin            342 Nov  7  1997 crontab.root
dr-xr-xr-x   2 bin        bin             96 Nov 24  2010 crontabs
drwxrwxrwt   2 root       sys           1024 Jul 11 20:20 tmp

it contains the cron of users allowed to use cron, for that you will have to look in /var/adm/cron what you have in cron.allow ( or cron.deny) file

Next question : Where is your cron file ? a good habit is to put in comment where it is to be found and always load /modify it there ( can be in user home directory...) because I saw a few times people desperate having lost their file, have no copies of it since they only use(d)
Code:
crontab -e

( meaning they are using the system's copy in /var/spool/cron/crontab).

Last edited by vbe; 07-12-2012 at 10:13 AM..
Sponsored Links
    #5  
Old 07-12-2012
Registered User
 
Join Date: Jun 2012
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
I tried using the ABC to get the details using :-

Code:
ABC@XXX:/var/spool/cron# ls -l
total 0
drwxrwx---    2 bin      cron            256 Jan 19 11:31 atjobs
drwxrwx---    2 bin      cron            256 Jul 10 16:24 crontabs

From this it seems that the user ABC is not listed here !
Afterwards I tried the same using root account and the following was displayed :-

Code:
root@XXX:/var/spool/cron/crontabs# ls -l
total 56
-rw-r--r--    1 adm      cron           2020 Feb 28 2007  adm
-rw-------    1 root     cron            222 Jan 22 2008  hostmon
-rw-------    1 root     cron            225 Jul  9 15:15 root
-rw-------    1 root     cron             85 Jun 22 15:11 root-5JULLY2012
-rw-r--r--    1 sys      cron            853 Feb 28 2007  sys
-rw-------    1 root     cron            199 Jul 10 16:24 tcadm
-rw-r--r--    1 root     cron           1122 Feb 28 2007  uucp





Other issue :- When I executed the following I am getting

Code:
root@XXX: /PPP/TRY/pXX/ACV/XXX/XXX /logs# crontab -l
14 15 22 6 5 /PPP/TRY/pXX/ACV/XXX/XXX/XXX/CronScriptCheck/Script.ksh
20 15 * * *  /PPP/TRY/pXX/ACV/XXX/XXX/XXX/CronScriptCheck/ AScript.ksh 

Now with the above job scheduling can I run another job scheduling at the same time in parallel to all or do I have to club all these jobs in one cronjob ?

Please suggest !
Sponsored Links
    #6  
Old 07-12-2012
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
 
Join Date: Sep 2005
Location: Switzerland - GE
Posts: 4,633
Thanks: 118
Thanked 256 Times in 245 Posts
If you have root account, then add your user in cron.allow (in /var/adm/cron/ directory) if cron. allow does not exist nor cron.deny (or cron.deny empty...), then anybody can use cron...

The best is to have a cronfile per user / product admin, but then you have no idea what is scheduled unless you read all the files... One is the best for reading and to see for performance issues /contention etc but then on that (root?) person can modify/change... Not suitable in production environments where DBAs are not going to let anyone touch what they plan nor sysadmin, and so you find a few operators with production job scheduling
Sponsored Links
    #7  
Old 07-12-2012
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
 
Join Date: Sep 2005
Location: Switzerland - GE
Posts: 4,633
Thanks: 118
Thanked 256 Times in 245 Posts
Here is from a aix (6.1) box:

Code:
n12:/home/vbe $ ll /var/adm/cron
total 116520
dr-xr-x---    2 bin      cron            256 Apr 30 2009  .
drwxrwxr-x   14 root     adm            4096 Jul 11 2011  ..
prw-------    1 root     cron              0 Jul 12 16:15 FIFO
-rw-r-----    1 bin      cron              4 Apr 30 2009  at.deny
-rw-r-----    1 bin      cron              3 Apr 30 2009  cron.deny
-rw-rw-r--    1 bin      bin        59620574 Jul 12 16:55 log
-rw-r--r--    1 root     sys            1313 Apr 30 2009  queuedefs

You can have only one of the files cron.allow OR cron.deny, here having cron.deny empty means all can use cron...
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Facing issues with tar and gzip ! acidburn_007 Shell Programming and Scripting 9 07-11-2012 03:09 AM
how to cancel a cronjob if the cronjob still running 2j4h UNIX for Dummies Questions & Answers 7 08-18-2010 08:16 AM
Issues with cronjob : Script using sendmail anshulporwal UNIX for Dummies Questions & Answers 7 06-04-2009 08:51 AM
Facing issue in Solaris OS in crontab for running shell script mabrar Shell Programming and Scripting 2 11-02-2007 06:32 AM
Facing an issue related to cronjob parindam HP-UX 1 09-13-2006 04:11 PM



All times are GMT -4. The time now is 08:52 PM.