Faculty of Engineering and Mathematical Sciences 
Not logged in (login)

help3002


This forum is provided to promote discussion amongst students enrolled in Computer Networks (CITS3002).
 
Before posting a question here, you may like to read the article How To Ask Questions The Smart Way.

If just starting the project, please search this forum for related topics (from Week-8) before posting new questions.
 
Options:
RSS cloud
Jump to:

Getting plot-to-html.sh for labsheet 2

9 of 654 articles shown, currently 1 other person reading this forum.
photo
From: Edward A.
Date: Tue 24th Mar, 12:26pm
Actions: 
        Login-to-reply
Everyone else has probably long completed this labsheet. But if there are any stragglers like me who are getting the following error when attempting to run plot-to-html.sh on Ubuntu:

./plot-to-html.sh: 26: ./plot-to-html.sh: Syntax error: "(" unexpected
The solution is to replace the shebang on the first line of the file /bin/sh with the line #!/bin/bash. Otherwise Ubuntu will use dash instead of bash as the shell for executing the file which causes some kind of error. I'd be interested to know why the error occurs and what differences exist between the two shells if anyone has any idea.

Getting plot-to-html.sh for labsheet 2

photo
From: Christopher M.
Date: Tue 24th Mar, 12:45pm
Actions: 
        Login-to-reply
On what platform are you seeing this Eddie - probably that troublesome "we refuse to be compatible" Arch?
It's their own fault if they've symbolically linked the standard shell to dash;
they shouldn't admit that their dash is incompatible with sh, link sh to dash,
and then require users to change their scripts.

But, I digress. Yes, changing the script to use /bin/bash will address the problem.

Getting plot-to-html.sh for labsheet 2

photo
From: Edward A.  O.P.
Date: Tue 24th Mar, 3:08pm
Actions: 
        Login-to-reply
Not even Arch, Ubuntu 18.04 for my sins.

Getting plot-to-html.sh for labsheet 2

photo
From: ANONYMOUS
Date: Tue 24th Mar, 4:07pm
Actions: 
        Login-to-reply
"Edward Atkinson"                               wrote:

> Not even Arch, Ubuntu 18.04 for my sins.

I experienced a similar issue on my Ubuntu 18.04 system.

Changing to #!/bin/bash worked nicely.

Getting plot-to-html.sh for labsheet 2

photo
From: Christopher M.
Date: Wed 25th Mar, 3:54am
Actions: 
        Login-to-reply
"Edward Atkinson"                               wrote:

> Not even Arch, Ubuntu 18.04 for my sins.

Ahh, my too-quick mistake.  A good rant wasted.

I note that the man entry for dash says:

    "The current version of dash is in the process of being changed to
     conform with the POSIX 1003.2 and 1003.2a specifications for the shell."

So many of the problems introduced by dash will hopefully be addressed.

-------
I've modified all of our lab/sample shellscripts to use /bin/bash,
so hopefully this won't be a problem in the future. Thanks.

Getting plot-to-html.sh for labsheet 2

photo
From: Kirra F.
Date: Wed 15th Apr, 2:26pm
Actions: 
        Login-to-reply
Hi everyone,

I've got an issue with plot-to-html.sh from lab2 and lab3. I'm able to run the script 
with the correct location for cnet but when I open up the .html produced, there isn't 
any data in it. This is shown at line 20 and 21 in the picture attached.

I'm running Ubuntu 18.04.4

Getting plot-to-html.sh for labsheet 2

photo
From: Kirra F.
Date: Wed 15th Apr, 2:29pm
Actions: 
        Login-to-reply
It seems like the picture wasn't uploaded so this is the relevant piece of code within the 
.html document produced:

 data.addColumn('number', 'seconds');
data.addColumn('number', 'STOPANDWAIT');
data.addRows([
]);

Getting plot-to-html.sh for labsheet 2

photo
From: Edward A.  O.P.
Date: Thu 16th Apr, 1:55pm
Actions: 
        Login-to-reply
"Kirra Fisher"                               wrote:

> It seems like the picture wasn't uploaded so this is the relevant piece of code within the 
> .html document produced:
> 
> {{{
>  data.addColumn('number', 'seconds');
> data.addColumn('number', 'STOPANDWAIT');
> data.addRows([
> ]);
> }}}


Hi Kirra,

It may be a problem with the path provided in the shell script to CNET on your system. On my Ubuntu 18.04 system I had to the change the line:

# location of the cnet simulator
CNET="/cslinux/bin/cnet"
To the location of your cnet install. On Ubuntu this can be easily achieved using the "whereis" command (Chris probably has a nicer alias but this is what I used), open a terminal and type:
whereis cnet
This will typically throw up a couple of answers, try them until it works. For reference my line reads:

# location of the cnet simulator
CNET="/usr/local/bin/cnet"

Getting plot-to-html.sh for labsheet 2

photo
From: Christopher M.
Date: Mon 20th Apr, 2:45pm
Actions: 
        Login-to-reply
"Kirra Fisher"                               wrote:

> It seems like the picture wasn't uploaded so this is the relevant piece of code within the 
> .html document produced:
> 
> {{{
>  data.addColumn('number', 'seconds');
> data.addColumn('number', 'STOPANDWAIT');
> data.addRows([
> ]);
> }}}

Hi Kirra,

You'll have noticed that the part of the script that produces the rows of stats:

      data.addRows([
        [10, 2],
        [20, 5],
        [30, 8],
        [40, 12],
      ....
        [7200, 1342],
        [7210, 1342],
      ]);

involves running the simulation itself, generating the periodic statistics, and filtering
for the metric that you want.  Assuming that the whole script is not dying with an error,
then there's either no stats (unlikely) or not ones you're looking for.
There's a line in there:

  grep -i "$METRIC" ...

which just matches stats for the metric that you want. METRIC is defined near the top of
the script, such as    METRIC="Messages delivered"
have you changed that line and, if so, to request one the metrics/stats reported by cnet?
If no lines match, there'll be no stats, and no rows for the Google Chart.
This Page


Program written by: [email protected]
Feedback welcome
Last modified:  8:27am May 24 2020