Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

  • Comments
  • unable to force log rotation manually through the network

    Posted on

    I currently have a network of 70 clients that we run simulation software on. It appear that when we have the simulation running the log do fill up and sometime when they rotate during the simulation this causes the file either not to rotate, which lock up the client, or does rotate but does not create a new current message file.

    I have written a script one of my firsts as a newbie to manually force the rotation. It however does not appear to work as I cannot access the file according to the output.

    Here is the script.

    /bin/sh!
    export SSHPASS="";
    #
    ssh-keygen && for host in $(cat hosts.txt)
    do
    sshpass -e ssh-copy-id -o StrictHostKeyChecking=no $host
    done;
    #
    for host in $(cat hosts.txt);
    do ssh "$host" ifconfig | grep -A 30 eth0 >> /home/user/Desktop/logrotate/output.$host;
    chmod 644 $host/etc/logrotate.conf;
    logrotate -f -v $host/etc/logrotate.conf 2>&1 | tee /home/user/Desktop/logrotate/output.$host;
    echo $host;
    done;
    echo "Logs cleaned up.";
    exit;

    I am new to scripting if any one has any ideas i would appreciate the help.

    Sincerely,

    Jon.

    by

    points

    Responses

    Red Hat LinkedIn YouTube Facebook X, formerly Twitter

    Quick Links

    Help

    Site Info

    Related Sites

    © 2026 Red Hat