cron job error: CANNOT EXECUTE Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: cron job error: CANNOT EXECUTE

  1. #1
    Join Date
    Sep 2000
    Hi Gurus,

    I created a simple shell script (named cleanup @ /usr dir). It deletes old files in a directory at selected times. Please see the following:
    cp /dev/null /var/adm/wtmpx
    cp /dev/null /var/cron/olog
    rm /var/adm/messages.0
    rm /var/adm/messages.1
    rm /var/adm/messages.2
    rm /var/log/syslog.0
    rm /var/log/syslog.1
    rm /var/log/syslog.2
    rm /var/log/syslog.3

    I can run it successfully by using sh command. However, I tried to cron it and i got the following error:

    -----------beginning of error message ---------------------------------------
    From oracle Thu Aug 2 08:16:00 2001
    Received: (from oracle@localhost)
    by prod_sun(8.8.8+Sun/8.8.8)
    for oracle; Thu, 2 Aug 2001 08:16:00 -0700 (PDT)
    Date: Thu, 2 Aug 2001 08:16:00 -0700 (PDT)
    From: oracle
    Message-Id: <200108021516@prod-sun>
    To: oracle
    Subject: Output from "cron" command
    Content-Type: text
    Content-Length: 129

    Your "cron" job on awp-sun

    produced the following output:

    sh: /usr/cleanup: cannot execute

    -----------end of error message -----------------------------------

    the cron command line is
    0,15,30,45 * * * * /usr/cleanup.

    This is my first time to create a cronjob from scratch. Please advise me if i missed or made any mistake. It would be appreciated very much.

    oracle 7.1.4 Unix os.

    JN :(

  2. #2
    Join Date
    Mar 2001
    If you mean that you can execute the "cleanup" script as follows:

    $ sh cleanup

    then execute the following command and it should run from the cron

    $ chmod 755 cleanup

    (it basically does not have execute perms)


  3. #3
    Join Date
    May 2001
    Is the owner of the cron job running your script the same owner of the file?

    This sometimes can cause issues if they are not.

    Good Luck

  4. #4
    Join Date
    Mar 2001
    It maybe help if you add the environment variant (.profile) to your cronfile.


  5. #5
    Join Date
    Nov 2000
    Yes, this looks like a permissions problem. Make sure you have execute permission on the /usr/cleanup script.

    ls -l /usr/cleanup should have something like:
    -rwxr-xr-x /usr/cleanup
    Jeff Hunter
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  6. #6
    Join Date
    Sep 2000


    Thanks millions, guys. It works after i did the chmod 755 ...

Posting Permissions

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

Click Here to Expand Forum to Full Width