I have Linux hosting server with centOS, which have WHM installed on it. To reduce the costing and mis-usage of Disk space i am creating a shell-script which automatically removes the suspended accounts which are suspended for more than 30 days and still using space on server.
Script:
root@ping [~]# cat autoterminate.sh
#!/bin/bash
find /var/cpanel/suspended/ -mtime +30 > autoterminate.txt
cut -d '/' -f5 /root/autoterminate.txt
echo "Users to remove"
cut -d '/' -f5 /root/autoterminate.txt > auto.txt
for i in `cat /root/auto.txt`; do /scripts/removeacct -y $i; done
When i run this script it is asking for yes or no response from my side.
root@ping [~]# ./autoterminate.sh
swicsor #this is the user which i found suspended more than 30 days
Users to remove
Unknown option: y
Are you sure you want to remove the account "swicsor", and DNS zone files for the user? [y/N]?
Basically i want this script to run in cronjob, but i am unable to do it, as it is asking manual response of "Yes" or "No". I will be great if anyone there can help me out.