Find the answer to your Linux question:
Results 1 to 4 of 4
This is my 1st attempt at scheduling something w/cron. This is a sles9 sp3 enviorment. I read up and it sounds straight forward, but whenI'm impliment it nothing happens(there should ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Jun 2006
    Posts
    141

    cron..what am I doing wrong??


    This is my 1st attempt at scheduling something w/cron.
    This is a sles9 sp3 enviorment.
    I read up and it sounds straight forward, but whenI'm impliment it nothing happens(there should be backup files and servers & db2 rotated).
    The command works as a standalone command(if I execute it).

    It has to run with root auth so I placed it in roots crontab(verified with a crontab -l)
    The way I view this is the command should run at 901 am tue-sat and the command will come from /opt/scripts and the command is combine0.sh
    Then throw the output away.
    Here is the command:
    1 9 * * 2,3,4,5,6 /opt/scripts/combine0.sh 2>&1 >/dev/null

    What am I missing??
    thanks
    Mace

  2. #2
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    I suggest you 1st start by not throwing away the output. Make the crontab entry:

    1 9 * * 2,3,4,5,6 /opt/scripts/combine0.sh > /opt/scripts/combine0.log 2>&1

    Then check to see if the log file is created. Then you'll know that the script at least ran. Make sure you have something in the beginning of the script like:

    echo "Running"

    so the log file will be created. If something failed then it might be in the log as well.

    One thing that most newbies don't know is that when a cron job runs the profile isn't run. So if you have things in your profile that you use in the script, that could be the problem.

    Vic

  3. #3
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    848
    From reading Unix Crontab - setting up cron jobs using crontab you could try:

    Code:
    1 9 * * 2-6 /opt/scripts/combine0.sh 2>&1 >/dev/null
    This should run combine0.sh located in the directory /opt/scripts at the time you specified and output to /dev/null

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Newbie
    Join Date
    Jun 2006
    Posts
    141
    vsemaska..thanks for the thought of putting a log in. You will laugh when you hear the solution.
    I was so use to being in the correct area when I submitted the tasks that I had forgot to cd to the correct area in the combine0.sh script.
    The msg I got was no file or directory.
    Put the cd in and it work like a charm

    thanks to all
    Mace

Posting Permissions

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