#!/bin/bash
ROOT=/home/jhosts/
cd $ROOT
if [ $# -eq 2 ]; then
if [[ "$2" = "rm" ]]; then
rm -R $1
echo $1 is removed
dir
else
mkdir $1
mkdir $ROOT$1/logs
chown jsproot:users -R $1/
chmod 777 -R $1/
useradd $2 -g users -s /bin/false -d $ROOT$1/
passwd $2
chown $2:users $ROOT$1/logs
#chmod 777 $ROOT$1/logs
echo $1 is created
fi
else
if [ $# -eq 3 ]; then
mkdir $1
mkdir $ROOT$1/logs
chown jsproot:users -R $1/
chmod 777 -R $1/
useradd -e $3 -f 35 $2 -g users -s /bin/false -d $ROOT$1/
passwd $2
chown $2:users $ROOT$1/logs
echo "$1 until ($3) is created"
else
echo "arguments for example: hiimeloyun.mn hiimeoyun 2012-12-21"
fi
fi
No comments:
Post a Comment