The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

see this script to fix webalizer to many users automatically.

Discussion in 'General Discussion' started by nettcom, Dec 23, 2004.

  1. nettcom

    nettcom Active Member

    Joined:
    Jul 5, 2003
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    have many users to fixwebalizer, bad using the script

    #!/bin/sh
    cd /home
    for file in *
    do
    /scripts/fixwebalizer $file > script.log
    sleep 2
    echo $file
    done

    I have small problem, script stop when Found bad log files,
    and when run again this script begin to fix from first user again

    anyone have an idea to modify this script to read users to fix from a txt file

    example:

    format of list-of-users-to fix.txt

    user1
    user2
    usern

    script ;
    -----------------
    (I don know the correct programming procedure)
    if any one can translate very thanks!

    #!/bin/sh

    open list-of-users-to fix.txt

    read all lines

    for $line
    do
    /scripts/fixwebalizer $file > script.log
    sleep 2
    echo $file

    done


    if any one helpme thanks!!
     
    #1 nettcom, Dec 23, 2004
    Last edited: Dec 23, 2004
  2. nettcom

    nettcom Active Member

    Joined:
    Jul 5, 2003
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    any one have a idea to write this small code to fix this script?
     
  3. nettcom

    nettcom Active Member

    Joined:
    Jul 5, 2003
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    this is the script:

    #!/bin/sh
    cd /home
    for file in *
    do
    /scripts/fixwebalizer $file > script.log
    sleep 2
    echo $file
    done

    we need modify this to read users from a file.txt
    to fix one to one.

    :)
     
  4. asmithjr

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    475
    Likes Received:
    1
    Trophy Points:
    18
    something like this below.

    cat file.txt | while read line
    do
    /scripts/fixwebalizer $line > script.log
    sleep 2
    echo $line
    done


    This will loop through the file reading line by line running the script.
     
  5. nettcom

    nettcom Active Member

    Joined:
    Jul 5, 2003
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    thanks!!!!!!!!!!!!!!

    this is working very good,
     
Loading...

Share This Page