Some handy scripts

From Linix VServer
Jump to navigationJump to 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
guest2
guest3 as=1048576 rss=131072
derjohn



Show next free context ID

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

Creates an output like this:

666
derjohn