Operating System - HP-UX
1748022 Members
5077 Online
108757 Solutions
New Discussion юеВ

Re: crontab for certain user doesn't work

 
petrbena
Occasional Advisor

Re: crontab for certain user doesn't work

Hi, thanks

 

The result of date is:

 

>  CMD: date >> /usw/app/oracle/admin/CRMISEF1/statspack/sh.log
>  oracle 8516 c Wed Oct 10 16:48:00 METDST 2012
<  oracle 8516 c Wed Oct 10 16:48:01 METDST 2012 ts=9

the command wasn't executed as expected

 

The path is:

PATH=/usr/bin:/usr/bin:/opt/ansic/bin:/usr/ccs/bin:/usr/contrib/bin:/opt/hparray/bin:/opt/nettladm/bin:/opt/upgrade/bin:/opt/fcms/bin:/opt/pd/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/mx/bin:/opt/resmon/bin:/opt/perf/bin:/opt/prm/bin:/opt/scr/bin://opt/perl/bin:/opt/ignite/bin:/opt/graphics/common/bin:/usr/sbin/diag/contrib:/opt/OV/bin/OpC:/opt/langtools/bin:/opt/imake/bin:/sbin/fs/vxfs3.5/bin:/usr/symcli/bin:/opt/ssh/bin:/opt/wbem/bin:/opt/wbem/sbin:/opt/gwlm/bin:/usr/local/bin:/opt/networker/bin:/opt/sfm/bin:/opt/CA/eTrustAccessControl/bin::/opt/CA/eTrustAccessControl/bin::/usw/app/oracle/product/8.1.7_64bit/bin:/usr/bin:/etc:/usr/ccs/bin:/usr/local/bin:/usr/sbin:/sbin:bin:.

there is no /etc/shells on that system

 

I executed the command using sh shell in terminal (over ssh), I just executed it from its directory (./test.sh) - that worked

but it doesn't work from cron

 

the permissions are 755

 

petrbena
Occasional Advisor

Re: crontab for certain user doesn't work

the user I used to execute was oracle, and regarding emails, I don't think there are any email for any users on that box. It seems that mails just don't work
Dennis Handly
Acclaimed Contributor

Re: crontab for certain user doesn't work

>I didn't change /bin/sh to /bin/sh -x but I doubt it would do anything since the script is clearly not even loaded

 

The script should be loaded and the -x processed.  I suspect it is dying in your .profile processing.  That -x may give you a clue.  Provided you redirect stderr to a file so we can ignore your mail issue.

petrbena
Occasional Advisor

Re: crontab for certain user doesn't work

I inserted -x option - to #!/bin/sh -x the cron log is still same:

 

>  CMD: /usw/app/oracle/admin/CRMISEF1/statspack/test.sh 2>&1
>  oracle 29277 c Tue Oct 16 10:04:00 METDST 2012
<  oracle 29277 c Tue Oct 16 10:04:00 METDST 2012 ts=9

keep in mind that even if I use simple date command, it fail

 

 

Dennis Handly
Acclaimed Contributor

Re: crontab for certain user doesn't work

>cron log is still same

 

Of course, since your mail isn't working.  You need to put back the redirection of the output:

/usw/app/oracle/admin/CRMISEF1/statspack/test.sh >> /usw/app/oracle/admin/CRMISEF1/statspack/sh.log 2>&1

 

Then look into sh.log.

cradules
Occasional Visitor

Re: crontab for certain user doesn't work

Hi,

I got to this post having same issues. First I did not realize what happend but rethiking my steps I found my cause.

I have set the cron for a user on certain of numbers of servers. To avoid login each server, I just created a script to do that for me on all server. The idea was to insert the cronjob onto /var/spool/crontabs/$user. That user had no cronjob setup before so this was first time the file was created.

From here the owner and permisions of the crontab were worg.  The file was 644 and the user was root and the group was main group of the root user (using sudo for inserting the conjob into the file)

Soon I have change the permisions to 400 and owner root with user's group (and ofc user part of cron.allow) the cron for the user started to work.

 

I am not sure if  this is going to help you, but I thought is worth to mention it.

 

Regards,