Posts

Showing posts from September, 2017

High process count notification - shell script

#Author : Jaison # Purpose : To send email to the user when a user hit a specific process count list. process_count="$(ps -u root  -L | wc -l)" if [ "$process_count" -gt "10000" ]; then  Email_Body='Test"   echo "$Email_Body" | /usr/bin/mail -s "Server $HOSTNAME Process Count : $process_count IS A LARGE VALUE FOR  USER. CHECK IMMEDIATELY. " <email_account> fi

useradd shell script - bulk read username and password from file.

# Author : Jaison #Purpose : Add user and set their password from the text file all.txt file_name="all.txt" while read user pass do     #useradd ${user} -p ${pass}     useradd ${user}     echo "${pass}" | passwd --stdin ${user}     echo "Adding user "${user}"  with the password  "${pass} done < $file_name