Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- [ $# -eq 2 ] || exec echo "usage: $0 <pid> <name>"
- pid=$1
- name=$2
- if ! grep -q /netns /proc/mounts; then
- ip netns add tmp$$
- ip netns del tmp$$
- fi
- if ! [ -d "/proc/$pid" ]; then
- echo "PID $pid doesn't exist"
- exit 1
- fi
- >"/run/netns/$name"
- mount --bind "/proc/$pid/ns/net" "/run/netns/$name"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement