Unable to kill sar process












1















I have a shell script to run JMeter test. Script generates the Jmeter log out put and creates sar (suppose to create sar file though it does not). Shell script is -



runtest() 
{
export JMETER_HOME=/home/software/apache-jmeter-2.6
host=$1
port=$2
loopcount=$3

logfile=jmeter$(date -d "today" +"%Y%m%d%H%M%S").jtl
sarfile=sar$(date -d "today" +"%Y%m%d%H%M%S").dat

sar -o $sar_file 3 100000 >/dev/null 2>&1 &
sar_pid=$!;
echo 'sar started with pid' $sar_pid;

for ((start=1; start <= $loopcount; start++ ))
do
echo 'Iteration' $start;
$JMETER_HOME/bin/jmeter.sh -n -t ReportWebService.jmx -Jhost=$host -Jport=$port -l $logfile
done
sleep 2
echo 'killing sar process id' $sar_pid
kill -9 $sar_pid;

}

runtest localhost 8087 1


When I execute the shell script, I eventually encounter error -



sar started with pid 13191
Iteration 1
Created the tree successfully using ReportWebService.jmx
Starting the test @ Tue Apr 17 11:16:24 IST 2012 (1334641584914)
Waiting for possible shutdown message on port 4445
Tidying up ... @ Tue Apr 17 11:16:25 IST 2012 (1334641585129)
... end of run
killing sar process id 13191
./temp.sh: line 22: kill: (13191) - No such process


And I don't see any ".dat" file generated for sar data. What is wrong with this shell script?










share|improve this question




















  • 4





    At the risk of pointing out the obvious, the sar command has evidently terminated by the time you get around to killing it. You should be investigating your sar command to see if it is working correctly. Try running the exact command outside the script. In addition, check your script for typos. In particular, your question has a typo: you set sarfile but use sar_file. Use a consistent variable naming scheme and check your original script to see if that typo exists.

    – jw013
    Apr 17 '12 at 6:28











  • the error was because of typo in sar_file, I wish I could mark your answer as right

    – Tarun
    Apr 17 '12 at 6:58
















1















I have a shell script to run JMeter test. Script generates the Jmeter log out put and creates sar (suppose to create sar file though it does not). Shell script is -



runtest() 
{
export JMETER_HOME=/home/software/apache-jmeter-2.6
host=$1
port=$2
loopcount=$3

logfile=jmeter$(date -d "today" +"%Y%m%d%H%M%S").jtl
sarfile=sar$(date -d "today" +"%Y%m%d%H%M%S").dat

sar -o $sar_file 3 100000 >/dev/null 2>&1 &
sar_pid=$!;
echo 'sar started with pid' $sar_pid;

for ((start=1; start <= $loopcount; start++ ))
do
echo 'Iteration' $start;
$JMETER_HOME/bin/jmeter.sh -n -t ReportWebService.jmx -Jhost=$host -Jport=$port -l $logfile
done
sleep 2
echo 'killing sar process id' $sar_pid
kill -9 $sar_pid;

}

runtest localhost 8087 1


When I execute the shell script, I eventually encounter error -



sar started with pid 13191
Iteration 1
Created the tree successfully using ReportWebService.jmx
Starting the test @ Tue Apr 17 11:16:24 IST 2012 (1334641584914)
Waiting for possible shutdown message on port 4445
Tidying up ... @ Tue Apr 17 11:16:25 IST 2012 (1334641585129)
... end of run
killing sar process id 13191
./temp.sh: line 22: kill: (13191) - No such process


And I don't see any ".dat" file generated for sar data. What is wrong with this shell script?










share|improve this question




















  • 4





    At the risk of pointing out the obvious, the sar command has evidently terminated by the time you get around to killing it. You should be investigating your sar command to see if it is working correctly. Try running the exact command outside the script. In addition, check your script for typos. In particular, your question has a typo: you set sarfile but use sar_file. Use a consistent variable naming scheme and check your original script to see if that typo exists.

    – jw013
    Apr 17 '12 at 6:28











  • the error was because of typo in sar_file, I wish I could mark your answer as right

    – Tarun
    Apr 17 '12 at 6:58














1












1








1








I have a shell script to run JMeter test. Script generates the Jmeter log out put and creates sar (suppose to create sar file though it does not). Shell script is -



runtest() 
{
export JMETER_HOME=/home/software/apache-jmeter-2.6
host=$1
port=$2
loopcount=$3

logfile=jmeter$(date -d "today" +"%Y%m%d%H%M%S").jtl
sarfile=sar$(date -d "today" +"%Y%m%d%H%M%S").dat

sar -o $sar_file 3 100000 >/dev/null 2>&1 &
sar_pid=$!;
echo 'sar started with pid' $sar_pid;

for ((start=1; start <= $loopcount; start++ ))
do
echo 'Iteration' $start;
$JMETER_HOME/bin/jmeter.sh -n -t ReportWebService.jmx -Jhost=$host -Jport=$port -l $logfile
done
sleep 2
echo 'killing sar process id' $sar_pid
kill -9 $sar_pid;

}

runtest localhost 8087 1


When I execute the shell script, I eventually encounter error -



sar started with pid 13191
Iteration 1
Created the tree successfully using ReportWebService.jmx
Starting the test @ Tue Apr 17 11:16:24 IST 2012 (1334641584914)
Waiting for possible shutdown message on port 4445
Tidying up ... @ Tue Apr 17 11:16:25 IST 2012 (1334641585129)
... end of run
killing sar process id 13191
./temp.sh: line 22: kill: (13191) - No such process


And I don't see any ".dat" file generated for sar data. What is wrong with this shell script?










share|improve this question
















I have a shell script to run JMeter test. Script generates the Jmeter log out put and creates sar (suppose to create sar file though it does not). Shell script is -



runtest() 
{
export JMETER_HOME=/home/software/apache-jmeter-2.6
host=$1
port=$2
loopcount=$3

logfile=jmeter$(date -d "today" +"%Y%m%d%H%M%S").jtl
sarfile=sar$(date -d "today" +"%Y%m%d%H%M%S").dat

sar -o $sar_file 3 100000 >/dev/null 2>&1 &
sar_pid=$!;
echo 'sar started with pid' $sar_pid;

for ((start=1; start <= $loopcount; start++ ))
do
echo 'Iteration' $start;
$JMETER_HOME/bin/jmeter.sh -n -t ReportWebService.jmx -Jhost=$host -Jport=$port -l $logfile
done
sleep 2
echo 'killing sar process id' $sar_pid
kill -9 $sar_pid;

}

runtest localhost 8087 1


When I execute the shell script, I eventually encounter error -



sar started with pid 13191
Iteration 1
Created the tree successfully using ReportWebService.jmx
Starting the test @ Tue Apr 17 11:16:24 IST 2012 (1334641584914)
Waiting for possible shutdown message on port 4445
Tidying up ... @ Tue Apr 17 11:16:25 IST 2012 (1334641585129)
... end of run
killing sar process id 13191
./temp.sh: line 22: kill: (13191) - No such process


And I don't see any ".dat" file generated for sar data. What is wrong with this shell script?







linux command-line






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 hour ago









Rui F Ribeiro

41.5k1483140




41.5k1483140










asked Apr 17 '12 at 5:54









TarunTarun

1084




1084








  • 4





    At the risk of pointing out the obvious, the sar command has evidently terminated by the time you get around to killing it. You should be investigating your sar command to see if it is working correctly. Try running the exact command outside the script. In addition, check your script for typos. In particular, your question has a typo: you set sarfile but use sar_file. Use a consistent variable naming scheme and check your original script to see if that typo exists.

    – jw013
    Apr 17 '12 at 6:28











  • the error was because of typo in sar_file, I wish I could mark your answer as right

    – Tarun
    Apr 17 '12 at 6:58














  • 4





    At the risk of pointing out the obvious, the sar command has evidently terminated by the time you get around to killing it. You should be investigating your sar command to see if it is working correctly. Try running the exact command outside the script. In addition, check your script for typos. In particular, your question has a typo: you set sarfile but use sar_file. Use a consistent variable naming scheme and check your original script to see if that typo exists.

    – jw013
    Apr 17 '12 at 6:28











  • the error was because of typo in sar_file, I wish I could mark your answer as right

    – Tarun
    Apr 17 '12 at 6:58








4




4





At the risk of pointing out the obvious, the sar command has evidently terminated by the time you get around to killing it. You should be investigating your sar command to see if it is working correctly. Try running the exact command outside the script. In addition, check your script for typos. In particular, your question has a typo: you set sarfile but use sar_file. Use a consistent variable naming scheme and check your original script to see if that typo exists.

– jw013
Apr 17 '12 at 6:28





At the risk of pointing out the obvious, the sar command has evidently terminated by the time you get around to killing it. You should be investigating your sar command to see if it is working correctly. Try running the exact command outside the script. In addition, check your script for typos. In particular, your question has a typo: you set sarfile but use sar_file. Use a consistent variable naming scheme and check your original script to see if that typo exists.

– jw013
Apr 17 '12 at 6:28













the error was because of typo in sar_file, I wish I could mark your answer as right

– Tarun
Apr 17 '12 at 6:58





the error was because of typo in sar_file, I wish I could mark your answer as right

– Tarun
Apr 17 '12 at 6:58










1 Answer
1






active

oldest

votes


















1














There's a typo in your question: you set sarfile but use sar_file, which is probably causing your sar command to exit with an error.






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f36591%2funable-to-kill-sar-process%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    There's a typo in your question: you set sarfile but use sar_file, which is probably causing your sar command to exit with an error.






    share|improve this answer




























      1














      There's a typo in your question: you set sarfile but use sar_file, which is probably causing your sar command to exit with an error.






      share|improve this answer


























        1












        1








        1







        There's a typo in your question: you set sarfile but use sar_file, which is probably causing your sar command to exit with an error.






        share|improve this answer













        There's a typo in your question: you set sarfile but use sar_file, which is probably causing your sar command to exit with an error.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 17 '12 at 7:02









        jw013jw013

        36.7k7101125




        36.7k7101125






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f36591%2funable-to-kill-sar-process%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            サソリ

            広島県道265号伴広島線

            Accessing regular linux commands in Huawei's Dopra Linux