Results 1 to 2 of 2

Thread: Cron tab to run a java file - pls help!

  1. #1
    Join Date
    Feb 2017
    Beans
    1

    Question Cron tab to run a java file - pls help!

    I'm having issues getting a cron tab to run a java file every 5 minutes and have searched tirelessly and tried many things to get it to work!


    I have tried to create an executable script to see if that is what's needed:


    My script and java file are both stored in /usr/local/bin

    My crontab:


    */5 * * * * /usr/local/bin/java-crontab.sh

    My script:#!/bin/bash
    export PATH=/usr/share/doc/openjdk-6-jre-headless:$PATH
    java -jar /usr/local/bin/javatest.jar

    My sys log says I don't have MTA installed - installed postfix that didn't solve
    anything so I removed that. Any help would be so much appreciated!!

  2. #2
    Join Date
    Oct 2009
    Location
    Elgin, IL USA
    Beans
    3,363
    Distro
    Ubuntu 16.10 Yakkety Yak

    Re: Cron tab to run a java file - pls help!

    cron is run with minimal env (assume that nothing is defined), and initial $PATH is undefined. Use full paths for everything run by cron. For example your $PATH does not include /usr/bin, so cron would not even know where to find java.
    Last edited by efflandt; February 9th, 2017 at 06:16 AM.
    i5 650 3.2 GHz upgraded to i7 870, 16 GB 1333 RAM, nvidia GTX 1060, 32" 1080p & assorted older computers

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •