Facing issues while running a cronjob !


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Facing issues while running a cronjob !
# 8  
Old 07-12-2012
i executed the following :-

Code:
root@XXX:/var/adm/cron# ls -l
total 157856
prw-------    1 root     cron              0 Jul 12 16:40 FIFO
-rw-r-----    1 bin      cron              4 Feb 28 2007  at.deny
-rw-r-----    1 bin      cron              3 Feb 28 2007  cron.deny
-rw-rw-r--    1 bin      bin        80754654 Jul 12 17:38 log
-rw-r--r--    1 root     sys            1317 Feb 28 2007  queuedefs
root@XXX:/var/adm/cron# more cron.deny
 
 
 
root@XXX:/var/adm/cron#

The cron.deny is blank !

But when i am trying to run my cronjob from the user ABC it says "Permission Denied". Don't know why it shows that !!!!


Could you please let me know that is it possible to run the scripts from root of different users i.e I want to execute the scripts of "user ABC and tbmadm" from the "root" through cronjob !

But while doing so it says that "Script.ksh" not found !

While if I try to run the scripts from the respective user accounts the scripts run in a fine manner !

Could you please mind to let me know that why is this happening !!
# 9  
Old 07-12-2012
Lets try to see from the beginning:
1)What OS, version, (architecture- platform) and shell are we dealing with (yes it matters not all cron have same implementation...)
2) a user can have his own cron - but he has to have the correct permissions where needed/requested - Is this the case?
3) for a user to be able to run "as" root (is that what you want??) then you have to install if not present, configure and use sudo or su2
4) to test the user can: write a little script and launch it via crontab two minutes later (add an output to check...) Did it work?
# 10  
Old 07-13-2012
We are using IBM AIX 5.3 and dealing with Korn Shell !
Currently we are dealing with 3 users namely ABC, tcadm and root.
I have 2 scripts :-
(1.) BackupScript.ksh
(2.) DeleteScript.ksh

For all three users.

Now, I want to run these scripts through a cronjob.

I am able to run the cronjob from the user tcadm but while doing the same from user ABC I am not able to run cronjob !

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


I am able to run the script from tcadm in a simple way :-

Code:
tcadm@XXX   /PPP/TRY/Pxx/ACV/XXX/XXX/XXX#      BackupScript.ksh

But WhenI try to do the same from root user I get :-

Code:
root@XXX  /PPP/TRY/Pxx/ACV/XXX/XXX/XXX#      BackupScript.ksh
 
ksh: BackupScript.ksh:  not found

While I am able to execute the same via
Code:
root@XXX  /PPP/TRY/Pxx/ACV/XXX/XXX/XXX#    ./ BackupScript.ksh

(1.) Why does this happen ?
(2.) In this manner how am I able to run the cronjobs of different users from root ?

Please suggest !
# 11  
Old 07-13-2012
Who is supposed to have cron scheduling? You are far from being clear:
Code:
tcadm@XXX   /PPP/TRY/Pxx/ACV/XXX/XXX/XXX#      BackupScript.ksh

works when the user runs it not root you say, but who is supposed to run that script?

What you see in your second code window are the effective cron jobs under the user's name, if tcadm is not there, it does not mean he has not right but more he has no planified jobs...

Your problem seems mostly to not be able to load a crontab and environment issues...
# 12  
Old 07-13-2012
Thanks for the reply.

Actually its root who is supposed to run all the cron jobs !

In the
Code:
crontab -e

I have appended all the cronjobs of various users in it.
# 13  
Old 07-13-2012
Quote:
We are using IBM AIX 5.3 and dealing with Korn Shell !
Currently we are dealing with 3 users namely ABC, tcadm and root.
I have 2 scripts :-
(1.) BackupScript.ksh
(2.) DeleteScript.ksh
On AIX (or other...) a ordinary user has not in his PATH /usr/sbin whre you find all usual administation commands...
I suggest you check your 3 users have it in ther PATH variable.
Then create symbolic links: /usr/sbin/BackupScript.ksh and /usr/sbin/DeleteScript.ksh

That will solve your not found issue...
Make sure to have the environment updated for your crontab file...
# 14  
Old 07-13-2012
Just saw you last post...
The best is definitely to create those symbolic links...

So if root is the only user with the jobs now, all the others will not be able to see anymore...If that is OK for you...

Last edited by vbe; 07-13-2012 at 11:12 AM.. Reason: typos...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Facing issues with shell script changes

My current requirement is to replace xxyxx string with value of date date1 variable holds a date and the current script writes html tags to a file as follows echo date1 nawk 'BEGIN{ FS="," print "<HTML>""<HEAD>""<p>Hi All,<br><br>There are no cases closed on the xxyxx" print ... (2 Replies)
Discussion started by: Rajesh A S
2 Replies

2. Shell Programming and Scripting

Facing issues with rsync

Hello Gurus, I am running rsync command to copy certain Directories and files into that directories to remote server. While ruuning the command all teh files has been copied but I am facing error. The below command I am executing to copy Directories and files to remote server: rsync -avrz ssh... (3 Replies)
Discussion started by: pokhraj_d
3 Replies

3. Post Here to Contact Site Administrators and Moderators

Regarding facing issues while accessing UNIX.com site

Hello Moderators/Admins, This is regarding an issue which I am facing from last 7 to 8 days. Issue is while trying to access this forum(simple hitting http://unix.com) I am able to login but many times my request gets timed out or 404 error or if I am able to login it will be excessive slow even... (0 Replies)
Discussion started by: RavinderSingh13
0 Replies

4. Shell Programming and Scripting

Facing issues with cronjobs

Hello Everyone, We have a cronjob scheduled to pick up files from one system and transfer to another system. the underlying code is a shell script. These cronjobs were working correctly until sometime. 2 days back they did not pick up the scripts but created empty logs. However when we tried... (6 Replies)
Discussion started by: Rads
6 Replies

5. UNIX for Dummies Questions & Answers

Having some issues with cronjob

Hi, i have a cronjob scheduled to run daily at 7AM , the job which i am executing has three other scripts in it to execute. The first scripts gets executed perfectly but the 2nd and 3rd scripts which take 4-5 mins to complete does not executes,is there anything that i am missing. This is... (3 Replies)
Discussion started by: vikatakavi
3 Replies

6. Shell Programming and Scripting

Facing issues with tar and gzip !

Hi, I am trying to :- (1.) Tar the file and then (2.) Gzip it ! Tar command :- tar -cvf BLUESTAR_Archive.log_$(date +%y_%m_%d_%H_%M).tar /app/local/XXX/XXX/XXX/logs Gzip command :- Gzip /app/local/XXX/XXX/XXX/logs/BLUESTAR_Archive.log_$(date +%y_%m_%d_%H_%M).tar ... (9 Replies)
Discussion started by: acidburn_007
9 Replies

7. UNIX for Dummies Questions & Answers

how to cancel a cronjob if the cronjob still running

hi everyone I'm newbie in this forum hope I can get some help here :) I have a command in crontab that executed every 1 minute sometime this command need more than 1 minute to finish the problem is, the crontab execute this command although it's not finish processing yet and causing the system... (7 Replies)
Discussion started by: 2j4h
7 Replies

8. UNIX for Dummies Questions & Answers

Issues with cronjob : Script using sendmail

Hi All, I am new to unix. I have created a cron job, that sends mail using sendmail utility. Am facing a unique problem while making a cron job for this script. In the script I append a file to my mail using 'cat' command. cat $report >> $mailMsg & this $mailMsg is used as mail... (7 Replies)
Discussion started by: anshulporwal
7 Replies

9. Shell Programming and Scripting

Facing issue in Solaris OS in crontab for running shell script

Hello i have a shell script. it is running fine when i manually run at command prompt using following command ./script_file but while running shell script from crontab, it is giving error in each line. (2 Replies)
Discussion started by: mabrar
2 Replies

10. HP-UX

Facing an issue related to cronjob

Dear All, I am facing an issue related to cronjob and explained below is the case study: 1. I have a java class named "DmCheckRenditionQueue.java" and placed under "/cpc/documentum/product/5.2.5/tomcat/webapps/rendition" 2. When I am using the command "/usr/openv/java/jre/bin/java -cp... (1 Reply)
Discussion started by: parindam
1 Replies
Login or Register to Ask a Question