Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # There are more reliable ways to check this, however, this should work for now.
- if [ `whoami` != "root" ]; then
- echo "$0 error: this script must be run as root." && exit 1
- fi
- # Check to see if the user is asking for help with -h or --help.
- case $1 in
- -h) echo "usage: $0 username email@address" && exit 0;;
- --help) echo "usage: $0 username email@address" && exit 0;;
- esac
- # Check to make sure the second argument contains @
- echo $2 | grep "@" > /dev/null
- if [ $? -ne 0 ]; then
- echo "$0 error: second argument must be an e-mail address." && echo "usage: $0 username email@address" && exit 1
- fi
- # Check to make sure that ONLY 2 arguments were supplied.
- case $# in
- 1) echo "the account of user $1 will be disabled.";;
- 2) echo "the account of user $1 with e-mail address $2 will be disabled.";;
- *) echo "$0 error: too few or too many arguments" && echo "usage: $0 username email@address" && exit 1;;
- esac
- echo "are you sure you want to disable the account of $1?"
- echo ""
- echo "To continue press Enter"
- echo "To cancel press CTRL+C"
- read answer
- kill $(pgrep -U `id -u $1` rtorrent) && passwd -l $1
- cat << EOF >> /home/cnz/userdetails/$1.disabled
- Your seedbox service account has been temporarily DISABLED due to non payment!
- Our system shows your account has a past due balance.
- Nothing has been deleted yet, however, your seedbox will be disabled until the past due balance has been paid.
- Please note that during this time period you will be unable to utilize our services. This is included to, but not limited to, SSH, FTP, and torrent traffic.
- Should you choose not to renew your subscription your account (and files) will be deleted in 7 days.
- If you have paid the past due balance already your account will be restored shortly. We apologize for any inconvenience.
- This is an automatically generated message.
- Thanks!
- EOF
- su cnz -c "mutt -s 'Your seedbox service account has been DISABLED.' $2 < /home/cnz/userdetails/$1.disabled"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement