Script Start (manually/automatic)

Discussion in 'General Server' started by chogger, Oct 18, 2013.

  1. chogger

    chogger New Member

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hello everyone,
    I have a very strange problem with a simple script. If I start it by hand
    Code:
    /squid/logrotate
    it worls perfect.

    If I put it into /etc/crontab it doesn't work. All files have 777 rights.


    crontab
    Code:
    SHELL=/bin/bash
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    MAILTO=root
    HOME=/
    
    # For details see man 4 crontabs
    
    # Example of job definition:
    # .---------------- minute (0 - 59)
    # |  .------------- hour (0 - 23)
    # |  |  .---------- day of month (1 - 31)
    # |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
    # |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
    # |  |  |  |  |
    # *  *  *  *  * user-name command to be executed
    0 23 * * * root /squid/logrotate
    
    logrotate script
    Code:
    #!/bin/sh
    
    
    /usr/sbin/logrotate -v /squid/logrotate.conf > /squid/var/logs/logrotate.log 2>&1
    EXITVALUE=$?
    if [ $EXITVALUE != 0 ]; then
        /usr/bin/logger -t logrotate "Squid Logrotate exited abnormally with [$EXITVALUE]"
    fi
    exit 0
    
    OS is CentOS 6.4

    Output in /var/logs/messages

    Code:
    Oct 17 23:00:01 proxy01-be logrotate: Squid Logrotate exited abnormally with [1]
    The logrotate.log is empty but last edited at 23 o clock

    Please help me, I am totally clueless
  2. arochester

    arochester Well-Known Member

    Messages:
    851
    Likes Received:
    273
    Trophy Points:
    63
  3. chogger

    chogger New Member

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    crontab -e output is:

    Code:
    no crontab for root - using an empty one
    But as said earlier I see that the os tried to start the task? Should I try to add it through crontab -e ?
  4. arochester

    arochester Well-Known Member

    Messages:
    851
    Likes Received:
    273
    Trophy Points:
    63
    Yes. Try it.

Share This Page