Difference between revisions of "Some handy scripts"

From Linux-VServer

Jump to: navigation, search
m (Somehandyscripts moved to Some handy scripts: Moved page to "correct" name :))
(+cat)
Line 25: Line 25:
 
</pre>
 
</pre>
 
|Signature=derjohn}}
 
|Signature=derjohn}}
 +
 +
[[Category:Documentaion]]

Revision as of 19:54, 21 October 2011

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