aboutsummaryrefslogtreecommitdiff
path: root/examples/var_service/nmeter/run
blob: fa0837bc4e5a7506e8526be451111a3a0ae8330e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

# Since per-process /proc/net/ (-> /proc/self/net/) appeared,
# we need to be root
user=root
tty="/dev/tty9"

chmod -R a+X . # or else env will moan
chown $user: $tty # devfs made happy

cmd="nmeter '%t %c x %x p%p f %f b %b m %m if%[nif]'"

exec >/dev/null
exec 2>&1
exec </dev/null

eval exec \
setuidgid "$user" \
env - PATH="$PATH" \
<"$tty" >"$tty" 2>&1 \
$cmd