#!/bin/bash ################################################# ## ## ## FTPsFTP ## ## standalone ftp/sftp server solution ## ## ## ################################################# # **** do not touch as long as you are not me **** version="v0.5_beta" author="david@socialnerds.org" giturl="git://git.socialnerds.org/ftpsftp.git" logwhat="ftpsftp" log2stdout="1" functionfile="/opt/ftpsftp/ftpsftp.func" configfile="/etc/ftpsftp.conf" # **** read function definitions and config file **** if [ -r $functionfile ]; then source $functionfile else echo "error: functionfile not found." exit 1 fi if [ -r $configfile ]; then source $configfile else echo "error: configuration file not found." exit 1 fi # **** load bashlib **** # need for some better routine to include bashlib if [ -d $bashlibpath ]; then source $bashlibpath/main source $bashlibpath/logengine log debug "preflight - logengine loaded" else echo "ERROR: bashlib not found" exit 1 fi # **** processing options **** while getopts "h,s,a:,d:,r:,q:,u,v" OPTION; do case $OPTION in h) usage exit 0 ;; s) stats exit 0 ;; a) accname=$OPTARG run="yes" while [ $run = "yes" ]; do add echo "do you want to create another user? (yes/no)" read run if [[ $run = "yes" ]] || [[ $run = "y" ]]; then echo "specify account name" read accname run="yes" fi done exit 0 ;; d) accname=$OPTARG delete exit 0 ;; r) accname=$OPTARG accpass=$(setpasswd) echo "the new password for user $accname is: $accpass" exit 0 ;; q) accname=$OPTARG quotaconf exit 0 ;; u) update exit 0 ;; v) version exit 0 ;; ?) usage exit 1 ;; esac done # **** print usage message if no option is given **** if [ -z $1 ]; then usage exit 1 fi # **** end of script **** exit 0