#!/bin/sh - # # Copyright (C) 2007 Oliver Fromme # All rights reserverd. Standard 2-clause BSD license and disclaimer apply. # # List processes that are running inside a jail. # This is intended to complement the standard jls(8) command. # # Usage: # jps list all jailed processes # jps list only processes in jail . # # Run the jls(8) command to get a list of jails and JIDs. # # Note: This script works for FreeBSD >= 6 only! # For FreeBSD 4.x, please use jailstat instead: # http://www.secnetix.de/~olli/scripts/jailstat # ME="${0##*/}" Usage() { cat <<-tac $ME -- List processes that are running inside a jail. This is intended to complement the standard jls(8) command. Usage: $ME list all jailed processes $ME list only processes in jail Run the jls(8) command to get a list of jails and JIDs. tac exit 1 } if [ $# -gt 2 ]; then Usage fi if [ $# -eq 1 ]; then case "$1" in ""|*[!0-9]*) Usage ;; esac FILTER='$1=="'$1'"' else FILTER='$1!="0"' fi ps -axww -o jid,pid,user,command | awk '$1!~/[0-9]/||'"$FILTER" | sort -n #--