Difference between revisions of "Some handy scripts"

From Linux-VServer

Jump to: navigation, search
(inital creation of the page)
 
m (Somehandyscripts moved to Some handy scripts: Moved page to "correct" name :))

Revision as of 06:59, 30 July 2007

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


Personal tools