Shell Script: Run benchmark and cpustat together


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell Script: Run benchmark and cpustat together
# 1  
Old 01-14-2015
What you need is the special variable $! which is the process ID of the last thing you put in the background. You can feed that into kill to get it to kill the right program.

Don't use -9 unless you absolutely have to. It will probably respond to less severe signals and make less mess by doing so.

Code:
cpustat ... &
PID="$!"

./long-multithread-benchmark

kill -TERM "$PID"
wait

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Cybersecurity

Is there an Automated script for CIS CentOS Linux 7 Benchmark please?

Hi, Apologies if this is not right section to post my requirement. We have a requirement to enhance our Centos 7 Servers' security as per "CIS CentOS Linux 7 Benchmark" ( CIS WorkBench / Home ) that provides guidance for establishing a secure configuration posture for CentOS 7. Just... (2 Replies)
Discussion started by: prvnrk
2 Replies

2. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

3. Solaris

Could you run this benchmark? (Especially if you have a V880 or V890)

Hi all I am currently using a T5120 to write and run some simulation code I've been working on which heavily relies on large matrix multiplication procedures. I am posting this to call out for some of you run and share the results of a simple benchmark I've written to compare the matrix... (1 Reply)
Discussion started by: toguro123
1 Replies

4. Solaris

CIS Benchmark script for solaris

Hello! Does anyone know where I can find a script that implements the CIS benchmark for Solaris, as described in their pdf file. Virginia Tech had links for it but the pages no longer exists. Thank you! (2 Replies)
Discussion started by: jabentay
2 Replies

5. Shell Programming and Scripting

Run a shell script from one host which connext to remote host and run the commands

I want to write a script which would run from one host say A and connect to other remote host B and then run rest of commands in that host. I tried connecting from A host to B with SSH but after connecting to host B it just getting me inside Host B command prompt. Rest of the script is not running... (6 Replies)
Discussion started by: SN2009
6 Replies

6. Shell Programming and Scripting

How to run cmds after changing to a new env (shell) in a shell script

Hi, I am using HP-UNIX. I have a requirement as below I have to change env twice like: cadenv <env> cadenv <env> ccm start -d /dbpath ccm tar -xvf *.tar ccm rcv .... mv *.tar BACKUP but after I do the first cadenv <env> , I am unable to execute any of the later commands . ... (6 Replies)
Discussion started by: charlei
6 Replies

7. Shell Programming and Scripting

Help need to make a shell script run for ffmpeg vhook watermaking in shell

i have a small problem getting a batxh shell script to run in shell this is the code the problem seems to be centered around the ffmpeg command, something maybe to do with the ' ' wrapping around the vhook part command this is a strange problem , if i take the ffmpeg command and... (1 Reply)
Discussion started by: wingchun22
1 Replies

8. Shell Programming and Scripting

How to Run a shell script from Perl script in Parent shell?

Hi Perl/UNIX experts, I have a problem in running a shell script from my perl script (auto.pl). I run the perl script using perl auto.pl from the shell prompt The shell script picks the files in "input" folder and procesess it. The shell script blue.sh has this code. export... (16 Replies)
Discussion started by: hifake
16 Replies

9. Shell Programming and Scripting

How to run unix commands in a new shell inside a shell script?

Hi , I am having one situation in which I need to run some simple unix commands after doing "chroot" command in a shell script. Which in turn creates a new shell. So scenario is that - I need to have one shell script which is ran as a part of crontab - in this shell script I need to do a... (2 Replies)
Discussion started by: hkapil
2 Replies
Login or Register to Ask a Question
OBNAM-BENCHMARK(1)					      General Commands Manual						OBNAM-BENCHMARK(1)

NAME
obnam-benchmark - benchmark obnam SYNOPSIS
obnam-benchmark [--config=FILE] [--description=DESCRIPTION] [--drop-caches] [--dump-config] [--dump-memory-profile=METHOD] [--dump-setting-names] [--file-size=SIZE] [--generate-manpage=TEMPLATE] [--generations=N] [-h] [--help] [--larch-branch=DIR] [--list-config-files] [--log=FILE] [--log-keep=N] [--log-level=LEVEL] [--log-max=SIZE] [--log-mode=MODE] [--no-default-configs] [--obnam-branch=DIR] [--output=FILE] [--profile-name=PROFILE-NAME] [--results=DIR] [--seivot-branch=DIR] [--seivot-log=SEIVOT-LOG] [--sftp-delay=SFTP-DELAY] [--size=PAIR] [--use-sftp-repository] [--use-sftp-root] [--verify] [--version] [--with-encryption] [FILE]... DESCRIPTION
obnam-benchmark benchmarks the obnam(1) backup application, by measuring how much time it takes to do a backup, restore, etc, in various scenarios. obnam-benchmark uses the seivot(1) tool for actually running the benchmarks, but makes some helpful assumptions about things, to make it simpler to run than running seivot directly. Benchmarks are run using two different usage profiles: mailspool (all files are small), and mediaserver (all files are big). For each pro- file, test data of the desired total size is generated, backed up, and then several incremental generations are backed up, each adding some more generated test data. Then other operations are run against the backup repository: restoring, listing the contents of, and removing each generation. The result of the benchmark is a .seivot file per profile, plus a Python profiler file for each run of obnam. These are stored in ../benchmarks. A set of .seivot files can be summarized for comparison with seivots-summary(1). The profiling files can be viewed with the usual Python tools: see the pstats module. The benchmarks are run against a version of obnam checked out from version control. It is not (currently) possible to run the benchmark against an installed version of obnam. Also the larch Python library, which obnam needs, needs to be checked out from version control. The --obnam-branch and --larch-branch options set the locations, if the defaults are not correct. OPTIONS
--config=FILE add FILE to config files --description=DESCRIPTION describe benchmark --drop-caches drop kernel buffer caches --dump-config write out the entire current configuration --dump-memory-profile=METHOD make memory profiling dumps using METHOD, which is one of: none, simple, meliae, or heapy (default: simple) --dump-setting-names write out all names of settings and quit --file-size=SIZE how big should files be? --generate-manpage=TEMPLATE fill in manual page TEMPLATE --generations=N benchmark N generations (default: 5) -h, --help show this help message and exit --larch-branch=DIR use DIR as the larch branch (default: /sbuild-nonexistent/larch/trunk) --list-config-files list all possible config files --log=FILE write log entries to FILE (default is to not write log files at all); use "syslog" to log to system log, or "none" to disable log- ging --log-keep=N keep last N logs (10) --log-level=LEVEL log at LEVEL, one of debug, info, warning, error, critical, fatal (default: debug) --log-max=SIZE rotate logs larger than SIZE, zero for never (default: 0) --log-mode=MODE set permissions of new log files to MODE (octal; default 0600) --no-default-configs clear list of configuration files to read --obnam-branch=DIR use DIR as the obnam branch to benchmark (default: .) --output=FILE write output to FILE, instead of standard output --profile-name=PROFILE-NAME short name for benchmark scenario --results=DIR put results under DIR (../benchmarks) --seivot-branch=DIR use DIR as the seivot branch (default: installed seivot) --seivot-log=SEIVOT-LOG seivot log setting --sftp-delay=SFTP-DELAY add artifical delay to sftp transfers (in milliseconds) --size=PAIR add PAIR to list of sizes to benchmark (e.g., 10g/1m) --use-sftp-repository access the repository over SFTP (requires ssh to localhost to work) --use-sftp-root access the live data over SFTP (requires ssh to localhost to work) --verify verify restores --version show program's version number and exit --with-encryption run benchmark using encryption ENVIRONMENT
TMPDIR This variable must be set. It controls where the temporary files (generated test data) is stored. If this variable was not set, they'd be put into /tmp, which easily fills up, to the detriment of the entire system. Thus. obnam-benchmark requires that the lo- cation is set explicitly. (You can still use /tmp if you want, but you have to set TMPDIR explicitly.) FILES
../benchmarks/ The default directory where results of the benchmark are stored, in a subdirectory named after the branch and revision numbers. EXAMPLE
To run a small benchmark: TMPDIR=/var/tmp obnam-benchmark --size=10m/1m To run a benchmark using existing data: TMPDIR=/var/tmp obnam-benchmark --use-existing=$HOME/Mail To view the currently available benchmark results: seivots-summary ../benchmarks/*/*mail*.seivot | less -S seivots-summary ../benchmarks/*/*media*.seivot | less -S (You need to run seivots-summary once per usage profile.) SEE ALSO
obnam(1), seivot(1), seivots-summary(1). OBNAM-BENCHMARK(1)