Weird problem with webmin cron jobs

Webmin
George K
2013-11-25
2013-11-27
  • George K
    George K
    2013-11-25

    Hello all,

    I haven't done a whole lot with cron yet, but since this problem has appeared, I have done a lot of googling without any resolution that I was able to find.

    I am running a Fedora Core instance on AWS, and I am running webmin on there.

    I have created scripts that I'd like to run daily.
    The scripts can run manually if I'm running them from interactive login.
    The scripts even run when I go to the Scheduled Cron Jobs within Webmin and select Run Now.
    However, when I schedule the job, it never runs. I have created a test script that doesn't have much in it, except to redirect a data command to a file. Again, it worked manually, through Run Now from webmin, but not with the scheduled.
    The cron.hourly (0anacron) seems to run though as I see it in the logs.
    /var/log/cron doesn't seem to show anything at all.

    I have made sure to point to all scripts with their absolute paths.
    The script itself resides in: /opt/gtmerp/
    I'm writing to the log in: /var/log/aws/ (I chowned this to: chown aws:root /var/log/aws -R)
    I would like to run the script as the user aws. Though for testing I thought I'd try running it as root, with no result.

    The actual script I'd like to run is the following:
    /bin/bash /opt/gtmerp/cronlog.sh /opt/gtmerp/change_instance_type.sh Demo D D i-7e9fh03 D D D >> /var/log/aws/DEMO_changeinstancetype_log

    I thought the command line had too many parameters, but even my test script, which I'm calling: /bin/bash /opt/gtmerp/test.sh isn't running either.

    Again, all run without a problem interactively via command line, or by clicking "Run Now" within the Cron Schedule.

    This may be something very simple I'm missing, but I'm at a loss, and could use your help.

    Thanks for the assistance!!

    Best,

     
  • George K
    George K
    2013-11-26

    Ok, I guess there is no reply. Just in case anyone has the problem, I thought I'd share the solution:
    This is mostly an AWS problem, because in this environment, you don't have an easy way to change the hardware clock, as it is connected to the backend host.

    The issue was essentially a scheduler problem, and a timezone problem.

    Even after I changed the timezones on the server, by copying the timezone to /etc/localtime, and verifying that all is reflected correctly, it seems like the cron daemon was still looking at the time UTC (based on the hardware clock)

    If you're running your own linux server, just make sure to change the hardware clock. If not, just make sure to input your schedules in cron in UTC, and not your own timezone. You can still use your own timezone for the server itself (that would be useful for logging and such.

    Hope this helps someone.

     
  • gandolf
    gandolf
    2013-11-27

    SOLVED