Find the answer to your Linux question:
Results 1 to 5 of 5
I have scheduled a cronjob like the following * 13 * * * /home/test/test.sh This should execute the script test.sh every minute from 13:00 hrs. But this is not happening.Following ...
  1. #1
    Just Joined!
    Join Date
    Dec 2007
    Posts
    4

    Exclamation Issue with cron job

    I have scheduled a cronjob like the following

    * 13 * * * /home/test/test.sh

    This should execute the script test.sh every minute from 13:00 hrs. But this is not happening.Following checks I made
    1.crond status is running
    2.initially the user din't have permission to execute the script.Later logged in as root inserted a empty file cron.deny in /etc path which gave permission to all users to use crontab.

    But still the script is not getting executed.But when run from command prompt script gets executed.

    Any help would be greatly appreciated

  2. #2
    Linux User Agent-X's Avatar
    Join Date
    May 2005
    Location
    Dimension X
    Posts
    261
    You need to put "bash" in there.
    How should it execute that script?

    * 13 * * * bash /home/test/test.sh

  3. #3
    Linux User peteh's Avatar
    Join Date
    Oct 2006
    Location
    UK
    Posts
    337
    If you run a cron job on a script in your \home directory you don't need to be root or give extra permissions unless the script is affecting files outside the \home folder.
    If your script starts "#! /bin/bash", you don't need bash in the cron line*.
    I think your cron job is set up to run every minute at 13.00 which means at best it would run once.
    Try:
    Code:
     1 * * * * \home etc ...
    EDIT: * provided you've also made it executable.
    Last edited by peteh; 12-13-2007 at 09:45 AM. Reason: to add the proviso
    Pete

  4. #4
    Linux User peteh's Avatar
    Join Date
    Oct 2006
    Location
    UK
    Posts
    337
    A rethink on my previous post.
    I think the cron line should read:
    Code:
     * 13-17 * * * \home\etc ...
    That would run it every minute between 13.00 and 17.00 hours.
    Pete

  5. #5
    Just Joined!
    Join Date
    Dec 2007
    Posts
    4
    Thanks for all your suggestions.Two changes made my script work.
    1. Instead of * 13 * * * /home/test/test.sh i provided * 13 * * * /bin/sh /home/test/test.sh
    2.My output file I expected in some other directory but it was placed in the home directory which after making changes for redirection of output file by giving proper path worked
    Thx

Posting Permissions

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