Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Location
    NJ
    Posts
    37

    Unanswered: question on calling command line from perl

    I just finished using a C program to update my mysql database with network data using mysql calls. This is fully functional and i wrote a perl script to go through the database and pull the information that i want to analze. I am currently analyzing bandwidth usage in my perl script and if it gets above a certain level i want to call a bandwidth limiting script. I am looking at cbqinit right now but i am not sure what is the best tool to limit incoming and outgoing bandwidth...Anyways to start that script at the command prompt you type: $ cbq.init start

    How do i call this from perl so i don't have to manually type it in the command line.. This is probably very trivial but i couldn't find the syntax. Any help would be appreciated

    thanks
    Evan

  2. #2
    Join Date
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: question on calling command line from perl

    Originally posted by goodolE22
    I just finished using a C program to update my mysql database with network data using mysql calls. This is fully functional and i wrote a perl script to go through the database and pull the information that i want to analze. I am currently analyzing bandwidth usage in my perl script and if it gets above a certain level i want to call a bandwidth limiting script. I am looking at cbqinit right now but i am not sure what is the best tool to limit incoming and outgoing bandwidth...Anyways to start that script at the command prompt you type: $ cbq.init start

    How do i call this from perl so i don't have to manually type it in the command line.. This is probably very trivial but i couldn't find the syntax. Any help would be appreciated

    thanks
    Evan
    If you are using linux with kernel >= 2.4.20 then use htb (is included in kernel) is better than cbq but also cbq is good...
    http://luxik.cdi.cz/~devik/qos/htb/

  3. #3
    Join Date
    Apr 2004
    Posts
    16
    To launch an external program, you use the system call:
    http://www.perldoc.com/perl5.8.0/pod/func/system.html

    If you want to capture the system output, you can use qx or backticks:
    http://www.perldoc.com/perl5.8.0/pod...Like-Operators

    For more control, use IPC::Open2 or IPC::Open3 which allow you to talk to STDIN, STDOUT and STDERR.
    http://www.perldoc.com/perl5.8.0/lib/IPC/Open2.html
    http://www.perldoc.com/perl5.8.0/lib/IPC/Open3.html
    perl -le 'print reverse reverse "just another perl hacker"'
    wush.net subversion hosting - remote hosted revision control with easy admin, ssl security & backups

Posting Permissions

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