cannot run cron job after changing location of logs.

Hello All,

We have a problem running a cronjob. First we had set the logs in user /home/dir directory. We use to su the user and set cron. But for now we have changed the log location for a new partition in /opt/dir/dir and now we are not able to run. We are able to run the cron with root user. Also changed the permission of the log location.

Could anybody please suggest any permissions we need to change for the cron to work.

Thanks,
agarud

If all you did was change the location of logs, upon which the cron job
acted, then I think your description of “cannot run cron job…” is
incorrect. It seems unlikely that changing something in a completely
separate part of the filesystem would prevent a working cron job from
continuing to work.

What may be happening is that the running cron job cannot do what it needs
to because of (as you surmised) permissions, but you can test that by
running your script as that user without using cron. Does it operate as
expected? If so, it should behave the same way in ‘cron’ as it did before
doing the file changes from /home to /opt. Test and let us know. If it
does not work, try calling the script with ‘bash -xv /path/to/script’
(putting in your path of course) and post the output here.


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…

[QUOTE=ab;23924]If all you did was change the location of logs, upon which the cron job
acted, then I think your description of “cannot run cron job…” is
incorrect. It seems unlikely that changing something in a completely
separate part of the filesystem would prevent a working cron job from
continuing to work.

What may be happening is that the running cron job cannot do what it needs
to because of (as you surmised) permissions, but you can test that by
running your script as that user without using cron. Does it operate as
expected? If so, it should behave the same way in ‘cron’ as it did before
doing the file changes from /home to /opt. Test and let us know. If it
does not work, try calling the script with ‘bash -xv /path/to/script’
(putting in your path of course) and post the output here.


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…[/QUOTE]

Thanks ab,

Will try the following.
One question, we were not able to run the job even when we gave permissions to the user (other than root) for the log location(/opt/dir/). We were able to run the job as root (it has all permissions). Earlier we were able to run it as the log location was in the /home dir of the user, for which he has full permissions as owner.

Thanks.

On 09/30/2014 09:14 AM, agarud wrote:[color=blue]

Will try the following.
why we were not able to run the job even when we gave permissions to the
user (other than root) for the log location(/opt/dir/). We were able to[/color]

Apparently you did not grant permissions to the extent needed. Post the
output requested and we can likely see exactly what is wrong while running
as the non-root user outside of cron.


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…

[QUOTE=ab;23928]On 09/30/2014 09:14 AM, agarud wrote:[color=blue]

Will try the following.
why we were not able to run the job even when we gave permissions to the
user (other than root) for the log location(/opt/dir/). We were able to[/color]

Apparently you did not grant permissions to the extent needed. Post the
output requested and we can likely see exactly what is wrong while running
as the non-root user outside of cron.


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…[/QUOTE]

Hello ab,
ran the job with bash -xv command throws error

Permission denied (publickey,keyboard-interactive).

  • ‘[’ 0 -eq 1 ‘]’
  • ‘[’ 1 -gt 0 ‘]’
    here i can run you through the process we follow
    We su user
    crontab -e
    here is the job for reference
          • /opt/dir/script.sh -d 5 -s user1@server:/dir/dir -t /newloc/dir -e mail@example.com.
            Th user and user1 are different users.

Thanks

On 09/30/2014 10:14 PM, agarud wrote:[color=blue]

Hello ab,
ran the job with bash -xv command throws error[/color]

Hooray, so it’s not a cron problem since this fails outside of cron. It
is nice to have that confirmed.
[color=blue]

Permission denied (publickey,keyboard-interactive).

  • ‘[’ 0 -eq 1 ‘]’
  • ‘[’ 1 -gt 0 ‘]’[/color]

Hmm… I was actually hoping for all of the output. It may e
substantial, but it’d help more than just the two or three lines above.

Either way, it looks like something to do with SSH is failing. If your
script is going to SSH (for example as ‘user1’ to ‘server’) then see if
that works when you become that user to test the script outside of cron.
You may want to include some prose here to share how you think SSH should
be working, including where the keys are stored and the permissions on the
directories and files holding those keys (all of them).


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…

[QUOTE=ab;23937]On 09/30/2014 10:14 PM, agarud wrote:[color=blue]

Hello ab,
ran the job with bash -xv command throws error[/color]

Hooray, so it’s not a cron problem since this fails outside of cron. It
is nice to have that confirmed.
[color=blue]

Permission denied (publickey,keyboard-interactive).

  • ‘[’ 0 -eq 1 ‘]’
  • ‘[’ 1 -gt 0 ‘]’[/color]

Hmm… I was actually hoping for all of the output. It may e
substantial, but it’d help more than just the two or three lines above.

Either way, it looks like something to do with SSH is failing. If your
script is going to SSH (for example as ‘user1’ to ‘server’) then see if
that works when you become that user to test the script outside of cron.
You may want to include some prose here to share how you think SSH should
be working, including where the keys are stored and the permissions on the
directories and files holding those keys (all of them).


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…[/QUOTE]

Thanks ab,
one more thing i noticed is that when we check the passwd file for the dev_user1 it shows /home/dev_user1 but when we cd to it it does not exist.
This is our dev environment. when we checked with our other environment with similar user for that environment it is able to login automatically, but for in DEV environment it asks for password.
ssh dev_user1@dev.example.com (it asks for password.)
ssh qa_user1@qa.example.com(it does not asks for password).

Also this was the error we received i posted there when we ran job using bash , other was the error which was mentioned in the script.sh.

Thanks