gmconklin

Just some guy in the world...

Homepage: https://garotmconklin.wordpress.com

AIM: garotmconklin

We Wish You A Merry Relay?


Maybe this is how Santa delivers his spam?

[root@mail ~]# qshape incoming active deferred

T 5 10 20 40 80 160 320 640 1280 1280+

TOTAL 14605 3050 1380 2446 7688 41 0 0 0 0 0

yahoo.com.tw 12065 2556 1156 1997 6321 35 0 0 0 0 0

msa.hinet.net 441 89 46 74 231 1 0 0 0 0 0

gmail.com 368 72 30 64 201 1 0 0 0 0 0

schofieldcare.org 137 8 3 11 115 0 0 0 0 0 0

xuite.net 54 16 4 10 24 0 0 0 0 0 0

pchome.com.tw 40 8 5 8 19 0 0 0 0 0 0

kimo.com 39 7 4 11 17 0 0 0 0 0 0

ms23.hinet.net 39 10 1 10 17 1 0 0 0 0 0

 

[root@mail log]# grep sasl_username=test maillog|wc -l

34734 <———————————————————- Number of email sent from the “test” account

[root@mail log]# grep C54715B8472 maillog | grep message-id|more

Dec 21 01:01:12 mail postfix/cleanup[31360]: C54715B8472: message-id=<a5c298c7fad7435bbdd26cf3efd937aa@263703c3aa76423dbdd91eb6ede2d4fd>

[root@mail log]# grep a5c298c7fad7435bbdd26cf3efd937aa@263703c3aa76423dbdd91eb6ede2d4fd maillog | grep cleanup

Dec 21 01:01:12 mail postfix/cleanup[31360]: C54715B8472: message-id=<a5c298c7fad7435bbdd26cf3efd937aa@263703c3aa76423dbdd91eb6ede2d4fd>

Dec 21 01:01:12 mail postfix/cleanup[31751]: D74115B8471: message-id=<a5c298c7fad7435bbdd26cf3efd937aa@263703c3aa76423dbdd91eb6ede2d4fd>

Dec 21 01:01:16 mail postfix/cleanup[31892]: 6E5E15B828E: message-id=<a5c298c7fad7435bbdd26cf3efd937aa@263703c3aa76423dbdd91eb6ede2d4fd>

[root@mail log]# grep C54715B8472 maillog

Dec 21 01:01:09 mail postfix/smtpd[29735]: C54715B8472: client=unknown[168.187.87.132], sasl_method=LOGIN, sasl_username=test@schofieldcare.org

Dec 21 01:01:12 mail postfix/cleanup[31360]: C54715B8472: message-id=<a5c298c7fad7435bbdd26cf3efd937aa@263703c3aa76423dbdd91eb6ede2d4fd>

Dec 21 01:01:12 mail postfix/qmgr[23536]: C54715B8472: from=<mykjfx@yahoo.com.tw>, size=2354, nrcpt=11 (queue active)

Dec 21 01:01:12 mail postfix/pipe[31966]: C54715B8472: to=<ting1019@ms34.hinet.net>, relay=mailprefilter, delay=3, status=sent (mail.schofieldcare.org)

Dec 21 01:01:12 mail postfix/pipe[31966]: C54715B8472: to=<t8813966@ms35.hinet.net>, relay=mailprefilter, delay=3, status=sent (mail.schofieldcare.org)

Dec 21 01:01:12 mail postfix/pipe[31966]: C54715B8472: to=<4811216@yahoo.com.tw>, relay=mailprefilter, delay=3, status=sent (mail.schofieldcare.org)

Dec 21 01:01:12 mail postfix/pipe[31966]: C54715B8472: to=<ae0420002000@yahoo.com.tw>, relay=mailprefilter, delay=3, status=sent (mail.schofieldcare.org)

Dec 21 01:01:12 mail postfix/pipe[31966]: C54715B8472: to=<g8322@yahoo.com.tw>, relay=mailprefilter, delay=3, status=sent (mail.schofieldcare.org)

Dec 21 01:01:12 mail postfix/pipe[31966]: C54715B8472: to=<jenny-yin@yahoo.com.tw>, relay=mailprefilter, delay=3, status=sent (mail.schofieldcare.org)

Dec 21 01:01:12 mail postfix/pipe[31966]: C54715B8472: to=<lisa9547343@yahoo.com.tw>, relay=mailprefilter, delay=3, status=sent (mail.schofieldcare.org)

Dec 21 01:01:12 mail postfix/pipe[31966]: C54715B8472: to=<louis79318@yahoo.com.tw>, relay=mailprefilter, delay=3, status=sent (mail.schofieldcare.org)

Dec 21 01:01:12 mail postfix/pipe[31966]: C54715B8472: to=<shinji123456@yahoo.com.tw>, relay=mailprefilter, delay=3, status=sent (mail.schofieldcare.org)

Dec 21 01:01:12 mail postfix/pipe[31966]: C54715B8472: to=<tung6008@yahoo.com.tw>, relay=mailprefilter, delay=3, status=sent (mail.schofieldcare.org)

Dec 21 01:01:12 mail postfix/pipe[31966]: C54715B8472: to=<yl2007606@yahoo.com.tw>, relay=mailprefilter, delay=3, status=sent (mail.schofieldcare.org)

Dec 21 01:01:12 mail postfix/qmgr[23536]: C54715B8472: removed

 

[root@mail log]# qshape incoming active deferred

T 5 10 20 40 80 160 320 640 1280 1280+

TOTAL 23 23 0 0 0 0 0 0 0 0 0

yahoo.com.tw 20 20 0 0 0 0 0 0 0 0 0

ms41.hinet.net 1 1 0 0 0 0 0 0 0 0 0

ms37.hinet.net 1 1 0 0 0 0 0 0 0 0 0

schofieldcare.org 1 1 0 0 0 0 0 0 0 0 0

[root@mail log]# qshape incoming active deferred

T 5 10 20 40 80 160 320 640 1280 1280+

TOTAL 14 14 0 0 0 0 0 0 0 0 0

yahoo.com.tw 11 11 0 0 0 0 0 0 0 0 0

schofieldcare.org 2 2 0 0 0 0 0 0 0 0 0

headwayofwny.org 1 1 0 0 0 0 0 0 0 0 0

[root@mail log]# qshape incoming active deferred

T 5 10 20 40 80 160 320 640 1280 1280+

TOTAL 14 14 0 0 0 0 0 0 0 0 0

yahoo.com.tw 11 11 0 0 0 0 0 0 0 0 0

schofieldcare.org 2 2 0 0 0 0 0 0 0 0 0

headwayofwny.org 1 1 0 0 0 0 0 0 0 0 0

[root@mail log]# qshape incoming active deferred

T 5 10 20 40 80 160 320 640 1280 1280+

TOTAL 4 4 0 0 0 0 0 0 0 0 0

schofieldcare.org 3 3 0 0 0 0 0 0 0 0 0

headwayofwny.org 1 1 0 0 0 0 0 0 0 0 0

[root@mail log]# qshape incoming active deferred

T 5 10 20 40 80 160 320 640 1280 1280+

TOTAL 4 4 0 0 0 0 0 0 0 0 0

schofieldcare.org 4 4 0 0 0 0 0 0 0 0 0

[root@mail log]# qshape incoming active deferred

T 5 10 20 40 80 160 320 640 1280 1280+

TOTAL 2 2 0 0 0 0 0 0 0 0 0

schofieldcare.org 2 2 0 0 0 0 0 0 0 0 0

[root@mail log]# qshape incoming active deferred

T 5 10 20 40 80 160 320 640 1280 1280+

TOTAL 0 0 0 0 0 0 0 0 0 0 0

 

[root@mail log]# qshape incoming active deferred

T 5 10 20 40 80 160 320 640 1280 1280+

TOTAL 0 0 0 0 0 0 0 0 0 0 0

[root@mail log]# mail -s “Test from Scofield SMB” gconklin@proserve-solutions.com

Cc:

Null message body; hope that’s ok

[root@mail log]# qshape incoming active deferred

T 5 10 20 40 80 160 320 640 1280 1280+

TOTAL 3 3 0 0 0 0 0 0 0 0 0

yahoo.com 1 1 0 0 0 0 0 0 0 0 0

schofieldcare.org 1 1 0 0 0 0 0 0 0 0 0

proserve-solutions.com 1 1 0 0 0 0 0 0 0 0 0

[root@mail log]# qshape incoming active deferred

T 5 10 20 40 80 160 320 640 1280 1280+

TOTAL 0 0 0 0 0 0 0 0 0 0 0

[root@mail log]#

, , , , , , , , , ,

Leave a comment

CIFS it is…


This is the final, fully tested and functional remote backup script for linux… Finally 🙂

#!/bin/bash
# A straght forward system backup script
#
LOGBASE=/var/log/backup/log
BACKUP_ROOT_DIR=”a/facts77 a/can”                       ## Backup dirs; do not prefix /
NOW=$(date +”%a”)                                       ## Get todays day
TSTAMP=$(date +”%l:%M:%S”)                              ## Get time stamp H:M:S
TDATE=$(date -I)                                        ## Get todays date
TAPE=”/oracle55vm_backup”                               ## Backup device name
TAR_ARGS=””                                             ## Exclude file
EXCLUDE_CONF=/root/.backup.exclude.conf                 ## Named file for file exclusion
LOGFILE=$LOGBASE/$TDATE.backup.log                      ## Backup Log file
FILELIST=$LOGBASE/$TDATE.backup.file-listing.log        ## Backup Log file list
UNAME=”xxx”
PWORD=”xxxXXXX”
SYSTEM=”`uname -n|cut -c 1-10`”
# Path to binaries
TAR=/bin/tar
MKDIR=/bin/mkdir
#
full_backup(){
local old=$(pwd)i
cd /
# Mount the samba destination
mount.cifs //bufvmfacts01/G/oracle55vm_backup $TAPE -o username=$UNAME,password=$PWORD
# Search the directory for files older than 7 days and delete them
find /oracle55vm_backup -type f -mtime +7|xargs -r rm -f
# Run the backup
tar -zcvf $TAPE/$SYSTEM.bak.`date -I`.tgz $BACKUP_ROOT_DIR # gzipping these
cd $old
}
# Make sure all dirs exits
verify_backup_dirs(){
local s=0
for d in $BACKUP_ROOT_DIR
do
if [ ! -d /$d ];
then
echo “Error : /$d directory does not exit!”
s=1
fi
done
# if not; just die
[ $s -eq 1 ] && exit 1
}
# Make some kind of status report
report_backup_info(){
touch $LOGBASE/$TDATE.backup.file-listing.log
cd $TAPE
echo ” ”
echo ”                        **** Backup Report ****”
echo ”                        ****   $TDATE  ****”
echo ” ——————————————————————————— ”
echo ” ################################################################################# ”
echo ” _________________________________________________________________________________ ”
echo ” ”
echo ” ”
echo ”  Backup start time: $TSTAMP”
echo ”  Operating System: `cat /etc/redhat-release`”
echo ” ”
echo ”  Size of the complete archive: `tar -ztvf $SYSTEM.bak.$TDATE.tgz|wc -c` Bytes”
echo ”  Size of the logged archive:   `cat $FILELIST|wc -c` Bytes”
echo ” ”
echo ”  File count of the completed archive: `tar -ztvf $SYSTEM.bak.$TDATE.tgz|wc -l` Files”
echo ”  File count of the logged archive:    `cat $FILELIST|wc -l` Files”
echo ” ”
echo ”  Remote CIFS Directory Listing:”
ls -lh
echo ” ”
echo ”  Disk Summary:”
df -h
echo ” ”
echo ” _________________________________________________________________________________ ”
echo ”                                                                                   ”
echo ” ################################################################################# ”
echo ” ——————————————————————————— ”
echo ” ”
cd –
} > $LOGFILE 2>&1
#
#
# Clean Up
clean_up(){
cd /
umount $TAPE # unmount the cifs mount
# Email the report
mail -s “System Backup $SYSTEM” gconklin@proserve-solutions.com < $LOGFILE
}
#
#
#### MAIN ####
#
# Make sure log dir exits
[ ! -d $LOGBASE ] && $MKDIR -p $LOGBASE
#
# Verify dirs
verify_backup_dirs
#
#
# Okay let us start backup procedure
# If it is Monday-Friday make a full backup;
# Weekend no backups
full_backup > $FILELIST 2>&1
#
#
# Make the simple report
report_backup_info
#
# Call the Clean UP function
clean_up

, , , , , , , , , , ,

Leave a comment

Pretty Linux?


So what do you think? Is it pretty? LOL 🙂

I guess I should have added how to actually do this… Here is the quick-n-dirty way:

Add the following to the bottom of your .bashrc file for whatever user:

#
alias ls=’ls –color’
LS_COLORS=’di=1;96:fi=0:ln=31:pi=5:so=5:bd=5:cd=5:or=31:mi=0:ex=35:*.rpm=94:*.tar=92:*.sh=32:*.log=91:*.gz=93:*.tgz=93′
export LS_COLOR

Here is a quick legend for the color associations:

di = directory
fi = file
ln = symbolic link
pi = fifo file
so = socket file
bd = block (buffered) special file
cd = character (unbuffered) special file
or = symbolic link pointing to a non-existent file (orphan)
mi = non-existent file pointed to by a symbolic link (visible when you type ls -l)
ex = file which is executable (ie. has ‘x’ set in permissions)

0   = default colour
1   = bold
4   = underlined
5   = flashing text
7   = reverse field
31  = red
32  = green
33  = orange
34  = blue
35  = purple
36  = cyan
37  = grey
40  = black background
41  = red background
42  = green background
43  = orange background
44  = blue background
45  = purple background
46  = cyan background
47  = grey background
90  = dark grey
91  = light red
92  = light green
93  = yellow
94  = light blue
95  = light purple
96  = turquoise
100 = dark grey background
101 = light red background
102 = light green background
103 = yellow background
104 = light blue background
105 = light purple background
106 = turquoise background

Also, you can combine more than one option per directive like this… *.log=91;1;42 which would give you this:

, , , ,

Leave a comment