Some handy scripts

From Linux-VServer

Revision as of 21:00, 21 October 2011 by Glenn (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The motivation for creating this page was to publish some bash scripts that can be used in combination with util-vserver to make your host management simpler or more comfortable. The idea is, that you can cut&paste them from here to your shell or re-use them in your own managemnt scripts.

Show rlimits of all guests

for i in $(ls /etc/vservers/); do echo -n "$i "; if [ -e /etc/vservers/$i/rlimits ]; then for j in $(ls /etc/vservers/$i/rlimits); do echo -en "$j=$(cat /etc/vservers/$i/rlimits/$j) "; done ; fi ; echo ""; done

Creates an output like this:

guest1 as=1048576 rss=131072
guest3 as=1048576 rss=131072

Show next free context ID

echo $(( $(sort /etc/vservers/*/context | tail -n 1) +1 ))

Creates an output like this:

Personal tools