Jump to content

Marcation

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Marcation

  1. I have tested the mamed pipe thru three small scripts : => the first one is called by snmpcd (snmp formating) echo .1.3.6.1.2.1.25.1.8.0 echo Gauge32 bash /usr/bin/local/secondscript => the secondscript with awk and named pipe : FIFO="/tmp/timefifo" [[ -e $FIFO ]] && rm $FIFO # if present then suppress it mkfifo $FIFO awk -W interactive '{printf("%-6d \n", $1*1000)}' <> $FIFO > /tmp/stats & /usr/bin/time -o $FIFO -f "%e" /usr/bin/thirdscript cat /tmp/stats killall awk [[ -e $FIFO ]] && rm $FIFO => the third script :define the operation You want to know the during : URL="example.html" for i in `seq 1 20`; do curl $URL > /dev/null 2>&1 done ******** It works, but there is a more simple solution : echo .1.3.6.1.2.1.25.1.8.0 echo Gauge32 before=$(date +%s%N) curl http://example.html > /dev/null 2>/dev/null after=$(date +%s%N) echo $((((after-before))/1000)) ********** result in microsecond
  2. Thanks to arox and my bad : I was trying to use some full version's option in the built in version of time. No need to install time, it's done in armbian, just give the full path\command : root@Bpi2+:~# time -f -f: command not found real 0m0,484s user 0m0,396s sys 0m0,089s root@Bpi2+:~# which time /usr/bin/time root@Bpi2+:~# /usr/bin/time -f /usr/bin/time: option requires an argument -- 'f' Usage: /usr/bin/time [-apvV] [-f format] [-o file] [--append] [--verbose] [--portability] [--format=format] [--output=file] [--version] [--quiet] [--help] command [arg...] root@Bpi2+:~# /usr/bin/time -f "%E" curl www.orange.fr 0:00.27 In such case type "type time" and the shell will inform you (is a shell keyword"). Thank You again I wanted to script some test and collect the results and this format is useful for this. My next step is to remove the ':' in the output (is not trivial to combine 'time' and pipe without writing the output in a file, may be I have to try something else). Be patient I can only write one post/day.... It's nice to have so small SBC and so large facilities and community. Thank You Armbian ! @Werner & @Igor Thank You for replying (maybe too fast ?) but You are wrong when You think that I did'nt red the man pages ... it was more complex.
  3. I wanted to format the output of the command "time" by adding -f, this returns an error, -h and --help are missing too. What are the accepted options ? thanks
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines