Linux System Information Script


#!/bin/bash

clear

echo “Hello, $USER”
echo

echo “Today’s date is date, this is week date +"%V".”
echo

w | cut -d ” ” -f 1 – | grep -v USER | sort -u
echo

echo “This is uname -s running on a uname -m processor.”
echo

echo “This is the uptime information:”
uptime
echo

echo “Free memory:”
free
echo

echo “Disk usage:”
df -kh
echo

Advertisements

PhpMyAdmin Automated Script for CentOS


#!/bin/bash

Updating System
yum -y update

Add the EPEL Repository
rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum -u update

Install Phpmyadmin
yum -y install phpmyadmin

Re-Starting Service
service httpd restart

Creating New Linux User Script


#!/bin/bash

while [ x$username = “x” ]; do
read -p “Please enter the username you wish to create : ” username
if id -u $username >/dev/null 2>&1; then
echo “User already exists”

username=””
fi
done
while [ x$group = “x” ]; do
read -p “Please enter the primary group. If group not exist, it will be created : ” group
if id -g $group >/dev/null 2>&1; then
echo “Group exist”
else
groupadd $group
fi
done
read -p “Please enter bash [/bin/bash] : ” bash
if [ x”$bash” = “x” ]; then
bash=”/bin/bash”
fi
read -p “Please enter homedir [/home/$username] : ” homedir
if [ x”$homedir” = “x” ]; then
homedir=”/home/$username”
fi
read -p “Please confirm [y/n]” confirm
if [ “$confirm” = “y” ]; then
useradd -g $group -s $bash -d $homedir -m $username
fi