#!/bin/bash WEBMIN_CONFIG=/etc/webmin WEBMIN_VAR=/var/webmin PERLLIB=/usr/share/webmin:/usr/share/webmin/vendor_perl WRAPPER_ORIGINAL_PWD=`pwd` unset SCRIPT_NAME unset FOREIGN_MODULE_NAME unset SERVER_ROOT unset SCRIPT_FILENAME export WEBMIN_CONFIG WEBMIN_VAR PERLLIB SCRIPT_NAME FOREIGN_MODULE_NAME SERVER_ROOT SCRIPT_FILENAME WRAPPER_ORIGINAL_PWD cd /usr/share/webmin/virtual-server id -a | grep -i uid=0 >/dev/null if [ "$?" != 0 ]; then echo "/usr/sbin/virtualmin must be run as root" exit 2 fi if [ "$1" = "" -o "$1" = "help" -a "$2" = "" -o "$1" = "--help" -a "$2" = "" -o "$1" = "-help" -a "$2" = "" ]; then echo "usage: /usr/sbin/virtualmin <command> [args..]" echo " or: /usr/sbin/virtualmin help <command>" echo "" echo "Available commands :" echo "" COMMAND=list-commands else COMMAND=$1 COMMANDINITIAL=$COMMAND fi shift if [ "$COMMAND" = "help" ]; then help=1 COMMAND=$1 shift fi echo $COMMAND | fgrep .pl >/dev/null if [ "$?" != "0" ]; then COMMAND="$COMMAND.pl" fi for dir in /usr/share/webmin/virtual-server /usr/share/webmin/virtual-server/pro; do if [ -x "$dir/$COMMAND" ]; then if [ "$help" = "1" ]; then exec perldoc $dir/$COMMAND else if [[ "$@" == "--help" ]]; then echo "See \`virtualmin help $COMMANDINITIAL\` for more details and examples" echo "" fi exec $dir/$COMMAND "$@" fi fi done echo Command $COMMAND was not found exit 1