Find the answer to your Linux question:
Results 1 to 5 of 5
I'm doing some cleanup of files through cron. The command is: /opt/scripts/cleanup.sh > /opt/scripts/cleanup.log 2>&1 But when I go to cleanup.log there is nothing there. The command is working as ...
  1. #1
    Linux Newbie
    Join Date
    Jun 2006
    Posts
    139

    Why is the log blank???

    I'm doing some cleanup of files through cron. The command is:
    /opt/scripts/cleanup.sh > /opt/scripts/cleanup.log 2>&1
    But when I go to cleanup.log there is nothing there.
    The command is working as the previous days files are gone.
    What am I doing wrong??
    thanks
    Mace

  2. #2
    Linux Newbie
    Join Date
    Mar 2008
    Location
    Hyderabad
    Posts
    109
    Just curious does cleanup.sh generate some output which you are redirectling to cleanup.log?

    One reason that cleanup.log doesn't contain anything is that as you are running cron. If not file has to be deleted on a given day then there will be not messages to llog for that day so nothing will be written.
    As you are making fresh file instead of appending the file will look empty on the given day.

  3. #3
    Linux Newbie
    Join Date
    Jun 2006
    Posts
    139
    I'm sorry I should have explained it.
    Yes, cleanup.sh has several commands(rm) that removes old files from the system to ensure we don't fill up a filesystem.
    I had a problem some time back and thought it would be nice to see what is happening but I get nothing from the commands

    thanks
    Mace

  4. #4
    Linux Newbie
    Join Date
    Mar 2008
    Location
    Hyderabad
    Posts
    109
    I wish to clearify myself.
    Suppose i have a file named junk. A script remove.sh with content
    rm junk
    When i type # ./remove.sh > logfile
    I expect logfile to be empty because rm command doesn't generate any output.
    Instead if i have

    rm junk
    echo " junk deleted "

    in remove.sh
    i will have
    junk deleted
    as content of my logfile.

    Apology if you already know

  5. #5
    Linux Newbie
    Join Date
    Jun 2006
    Posts
    139
    digvijay.gahlot thank you for the response. I was hoping that rm would send what it was deleting. I guess I could ls the filesystem before and after to truely show what was there and what is deleted.
    Thanks 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
  •  
...