cat log_file_viewer.sh
>>
#################################
# Multiple Log File Viewer (Linux Bash)
# Programmed By DanBrother
#################################
#!/bin/bash
function pause(){
read -p "$*"
}
DanBrother 發表在 痞客邦 留言(0) 人氣(6)
DanBrother 發表在 痞客邦 留言(0) 人氣(1)
DanBrother 發表在 痞客邦 留言(0) 人氣(7)
#################################################################
# To Generate a lottery text randomly within 10 different files
#!/bin/bash
#################################################################
file_dir='/backup/files'
array=(file_1 file_2 file_3 file_4 file_5 file_6 file_7 file_8 file_9 file_10)
my_lottery1=$((RANDOM%${#array[@]}))
my_lottery2=$((RANDOM%${#array[@]}))
DanBrother 發表在 痞客邦 留言(0) 人氣(4)
-- 查iconv之版本
$ iconv -V
iconv (GNU libc) 2.5
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Ulrich Drepper.
DanBrother 發表在 痞客邦 留言(0) 人氣(129)
How to Rescan SCSI Disk Without Reboot in Linux?
[root@test ~]# ls -l /sys/class/scsi_host
total 0
drwxr-xr-x 2 root root 0 Apr 15 11:00 host0
drwxr-xr-x 2 root root 0 Apr 15 11:00 host1
drwxr-xr-x 2 root root 0 Apr 15 11:00 host2
drwxr-xr-x 2 root root 0 Apr 15 11:00 host3
drwxr-xr-x 2 root root 0 Apr 15 11:00 host4
DanBrother 發表在 痞客邦 留言(0) 人氣(53)
Fast switch to BDUMP (Background Dump or Diag Trace) Directory using Linux Function in Oracle RAC environment
/shared_dir/script/dba_functions
>>
# Switch to bdump directory
function tobdump {
lower_sid=$(echo "$ORACLE_UNQNAME" | tr '[:upper:]' '[:lower:]')
cd $ORACLE_BASE/diag/rdbms/$lower_sid/$ORACLE_SID/trace
pwd
}
DanBrother 發表在 痞客邦 留言(0) 人氣(8)
Linux Server Login Alert Script
The following script demonstates a way to send out an alert email when someone logs in the Linux Server.
vi /script/login_alert.sh
#!/bin/bash
host=`hostname`
user=`whoami`
ip="$(echo $SSH_CLIENT|awk '{print $1}')"
mkdir -p ~/ServerLoginTrace
echo 'ALERT - ' $user ' IP:'$ip ' Shell Access' $host > ~/ServerLoginTrace/alert_message.txt
pinky >> ~/ServerLoginTrace/alert_message.txt
chmod 600 ~/ServerLoginTrace/alert_message.txt
mutt -s "Login Monitor from $host" -- danbrother@pixnet.net < ~/ServerLoginTrace/alert_message.txt
DanBrother 發表在 痞客邦 留言(0) 人氣(24)
Send Email using Mutt Program In Linux
Step 1. Install ssmtp program to deliver an email from a server to a configured mailhub.
DanBrother 發表在 痞客邦 留言(0) 人氣(64)
Here are the steps to change (rename) Linux hostname without rebooting:
1. edit /etc/sysconfig/network as follows: (* change danbrother to whatever your new hostname would be)
HOSTNAME=danbrother
2. edit /etc/hosts as follows:
192.168.100.101 danbrother
3. hostname danbrother
4. service network restart
DanBrother 發表在 痞客邦 留言(0) 人氣(12)