Results 1 to 6 of 6
  1. #1

    Automatically shut down the server?

    At the moment I am taking it into consideration switching to a Root Server, but the webhost which offers it provides no functionality on how to limit the traffic going to and from the server.
    Is it possible to code a script which automatically shuts down the server after a pre-defined amount of in- and out-going traffic? I fear that we might someday exceed the traffic limit (drastically?) and have to pay a lot of money for those extra gigabytes, which I honestly can't afford.

  2. #2
    Join Date
    Sep 2002
    Posts
    256
    On windows platforms there are transfer limiters that can be placed on a domain (and I imagine more than one) to keep track of and block the website once the limit goes over a pre-approved limit.

    I have to assume there are similar things out there for Linux machines too.

  3. #3
    Join Date
    Sep 2002
    Location
    Mansfield
    Posts
    314
    Might want to ask your provider to cap the pipe or at least show stats and send alarms.

    These things can be built in to a contract with a good provider.

    Then there's ipfw/ipchains
    GUI admin tools have no honor. It is a good day to vi.

  4. #4
    It is easily possible to see the traffic stats in their configuration menu, but they don't send out automated alarms.
    Is there a way to code an automated shutdown -h now after, let's say, 48 gb traffic have passed?

    The company is the leading webhost in germany and my own experience tells me the same. Their only downside is that they don't offer any method to limit the traffic to their root servers, which can get very expensive under certain circumstances.
    It's a Linux machine with Suse 8.0.

  5. #5
    Join Date
    Sep 2002
    Location
    Mansfield
    Posts
    314
    Looks like ipfw/ipchains then.

    Once the data is trapped, simple cron will do it.

    *5/ * * * * /usr/local/2muchmoney.sh
    #!/bin/sh
    # 2muchmoney.sh
    # Shutdown if limits exceeded
    #/usr/local/bin/ipfw_count.sh scripts feed $LOG and do calculations.
    LOG=/tmp/transfer.log

    if [ $LOG -ge "48" ]

    then mailx -s "Limit exceeded. `hostname` shutdown." [email protected] <$LOG
    shutdown -h now

    else continue

    fi

    The 48 may be 480000 or however you measure it.

    BTW, testing could be a pain.
    GUI admin tools have no honor. It is a good day to vi.

  6. #6
    Thank you very much for the script and indeed, testing will be a pain .
    But I will install this script on my PC here and test it, I don't quite want to waste that bandwidth on the actual server when I'll buy it.

Posting Permissions

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