August 25, 2016

MYSQL BAKUP USING SHELLS SCRIPTS



Kindly find the MYSQL shells scripts in given below.

-------------------------------------------------------------------------------------------------------

#! /bin/bash

# You are free to modify and distribute this code,
# so long as you keep my name and URL in it.

# your MySQL server's name
SERVER=10.0.0.125

# directory to backup to
BACKDIR=/root/mysqlbackup/

# date format that is appended to filename
DATE=`date +'%m-%d-%Y'`

#----------------------MySQL Settings--------------------#

# your MySQL server's location (IP address is best)
HOST="10.0.0.125"

# MySQL username
USER="root"

# MySQL password
PASS="xxxxx"

# List all of the MySQL databases that you want to backup in here, 
# each separated by a space
DBS="XXXX"

# set to 'y' if you want to backup all your databases. this will override
# the database selection above.
DUMPALL="n"


#----------------------Mail Settings--------------------#

# set to 'y' if you'd like to be emailed the backup (requires mutt)
MAIL=y

# email addresses to send backups to, separated by a space
EMAILS="suppport@magicalbinary.com"

SUBJECT="MySQL backup on $SERVER ($DATE)"

#----------------------FTP Settings--------------------#

# set "FTP=y" if you want to enable FTP backups
FTP=n

# FTP server settings; should be self-explanatory
FTPHOST="10.0.0.127"
FTPUSER="XXX"
FTPPASS="XXX"

# directory to backup to. if it doesn't exist, file will be uploaded to 
# first logged-in directory
FTPDIR="/home/value"

#-------------------Deletion Settings-------------------#

# delete old files?
DELETE=y

# how many days of backups do you want to keep?
DAYS=6

#----------------------End of Settings------------------#
# check of the backup directory exists
# if not, create it
if  [ -e $BACKDIR ]
then
    echo Backups directory already exists
else
    mkdir $BACKDIR
fi

if  [ $DUMPALL = "y" ]
then
    echo "Creating list of all your databases..."

    mysql -h$HOST -u$USER -p$PASS "dlr" "dlr"  > dbs_on_$SERVER.txt

    # redefine list of databases to be backed up
    DBS=`sed -e ':a;N;$!ba;s/\n/ /g' -e 's/Database //g' dbs_on_$SERVER.txt`
fi

echo "Backing up MySQL databases...$DBS"
read p1
for database in $DBS
do
    mysqldump -h$HOST -u$USER -p$PASS $database dlr > "$BACKDIR/$SERVER-mysqlbackup-$database-$DATE.sql"
    gzip -f -9 "$BACKDIR/$SERVER-mysqlbackup-$database-$DATE.sql"

# if you have the mail program 'mutt' installed on
done
# your server, this script will have mutt attach the backup
# and send it to the email addresses in $EMAILS

if  [ $MAIL = "y" ]
then
BODY="Your backup is ready, please check"
ATTACH=`for file in $BACKDIR/*$DATE.sql.gz; do echo -n "-a ${file} ";  done`

    echo "$BODY" | mutt -s "$SUBJECT" $ATTACH $EMAILS
        
    echo -e "Your backup has been emailed to you! \n"
fi

if  [ $FTP = "y" ]
then
echo "Initiating FTP connection..."
cd $BACKDIR
ATTACH=`for file in *$DATE.sql.gz; do echo -n -e "put ${file}\n"; done`

    ftp -nv <<EOF
    open $FTPHOST
    user $FTPUSER $FTPPASS
    cd $FTPDIR
    $ATTACH
    quit
EOF
echo -e  "FTP transfer complete! \n"
fi

if  [ $DELETE = "y" ]
then
    find $BACKDIR -name "*.sql.gz" -mtime $DAYS -exec rm {} \;

    if  [ $DAYS = "1" ]
    then
        echo "Yesterday's backup has been deleted."
    else
        echo "The backup from $DAYS days ago has been deleted."
    fi
fi

echo Your backup is complete!

TCP/IP NETWORKING MANAGEMENT

  • /etc/hosts, /etc/sysconfig/network, /etc/sysconfig/network-scripts/ifcfg-ethX
  • ifconfig, ifconfig ethX up, ifconfig ethX down, ifup ethX, ifdown ethX
  • IP aliasing
  • ping –c –a x.x.x.x
  • IP classes :
  • A – 10.0.0.0 to 10.255.255.255
  • B – 172.16.0.0 to 172.31.255.255
  • C – 192.168.0.0 to 192.168.255.255
  • Subnetting and subnet masks
  • CIDR: Classless Inter-Domain Routing
  • TCP/IP layers –
  • Applications – FTP, HTTP, SSH. EU-Apps
  • Transport [TCP,UDP] – Delivery of data to apps. Uses segments.
  • Network [IP,ICMP] – Basic comm, H/W, routing. Uses packets.
  • Link [ARP, DevDrvrs] – NW H/W, devdrvs. Uses frames.
  • Physical – Copper Wires, physical medium, cables, Ethernet, Optical fibres, FDDI, ATM, IPX/SPX, Token ring
  • MTU and fragmentation
  • 6-byte MAC addresses and "http://www.iana.org/assignments/ethernet-numbers for the first 3 bytes.
  • 4-byte quad-dot, IP addrs, virtual Loopback addr,Ports, /etc/services, sockets, Privileged and Well-known ports
  • Address types –
  • Unicast – addrs that refer to a single host [NIC actually]
  • Multicast – addrs that identify a group of hosts [224 to 239] Good for videoconferencing
  • Broadcast – addrs that include all the hosts on the local network
  • Routing – Routing Tables, ICMP redirects
  • Static routing
  • /etc/sysconfig/static-routes : eth0 net 192.168.0.20 netmask 255.255.255.0 gw 192.168.0.10
  • netstat -r, netstat –rn
  • The destination is a NW address
  • The gateway must be a host address of a m/c which specifies that pkts must be sent to it to reach the destination address.
  • Gateway is the default route
  • Configuring static routes
  • route add –net 192.168.0.10 netmask 255.255.255.0 gw 192.168.0.10 eth1
  • route add default gw 192.168.0.10 eth0
  • /etc/sysconfig/network : GATEWAY=x.x.x.x and the default route
  • Local DNS and name resolution : and /etc/host.conf, /etc/nsswitch.conf
  • Dynamic routing – routed, gated
  • ICMP redirects
  • ARP – The Addr resolution protocol
  • mii-tool – Configuring autonegotiation and other media-specific options

  • Network Interfaces Config tools :
  • netconfig
  • netconf
  • netcfg
  • redhat-config-network
  • neat
  • neat-tui
  • neat-control
  • redhat-config-network-cmd
  • redhat-config-network-druid

August 24, 2016

Install OCS Inventory NG Agent 2.1 on Windows Operating Systems.

Download OCS Inventory: Windows Agent  from Here
1. Run “OCS-NG-Windows-Agent-Setup.exe” on client computer..



2. and click “Next” button


3. Validate license agreement by clicking “I agree” button.

4. Click "Next" button

5. Fill in OCS Inventory NG Communication server URL, like http://192.168.15.51/ocsinventory & Validate certificates....and click Next


6. Next

7. By default, OCS Inventory Agent write only few information in log files. You may increase this enabling “Verbose log”. You may also enable TAG question, or specify the TAG value. and immediatly Launch inventory just at the end of setup.


8. Click Install

9. Click Finish and check Start OCS inventory NG systray Applet



10. View info on server



Finished!

August 23, 2016

Fixed "Failed to connect to a windows service windows 7"

Then I get a message: "Failed to connect to a Windows Service. Windows could not connect to the System Event Notification Service. This problem prevents standard users from logging onto the system. As an Administrative User, you can review the System Events Log for details about why the service didn't respond."





Step 1

Go to Start -> type cmd-> right click cmd.exe -> Run as administrator

traning
Chọn quyền administrator để reset máy


Step 2

Type: netsh winsock reset -> Enter , you will see the message same below
Next you mush restart the computer in order to complete!
reset

Furthermore, seeing this video:



Have Fun.

August 22, 2016

Deny and allow workstation logons with Group Policy

One of the bigger challenges in some Active Directory environments is controlling who is allowed to log into workstations. By default, every user in AD automatically gets added to Domain Users. Domain Users is, once again by default, included in the local Users group on workstations when the workstations get added to AD. That means that unless you take action on either the user account or the computer configuration, any user account in your AD environment can log into any computer whether you want them to or not. If you’re in a smaller AD environment, this may not be a problem for you: you can go to the Account tab in Active Directory Users and Computers, click the “Log On To…” button and specify the computers the user is allowed to use.
Deny logon - ADUC Account tab Log On To
ADUC Account tab Log On To
However, in a larger environment, managing individual accounts can be very time consuming, especially if you have to manually specify computer names for every single user account that needs limited access. You can also run into other authentication problems using “Log On To…” if the account needs to access network resources.
The good news is that there is a Group Policy setting that works with every version of Windows that can be managed with Group Policy from Windows 2000 through Windows 8 that will solve this problem for you. These settings can be found in Computer Configuration > Policies > Security Settings > Local Policies > User Rights Assignment.
Deny logon - Setting in Group Policy Editor
Deny logon – Setting in Group Policy Editor

Deny log on locally ^

The “Deny log on locally” specifies the users or groups that are not allowed to log into the local computer. This policy can be found in Computer Configuration > Policies > Security Settings > Local Policies > User Rights Assignment > Deny log on locally.
Deny log on locally Properties
Deny log on locally Properties
In my example, I’ve created a special group just for user accounts that I don’t want logging into an OU of computers. However, you can use any AD group here. Just avoid default AD groups like Domain Users or any of the Admin groups if you don’t want to get locked out.

Allow log on locally ^

The “Allow log on locally” setting specifies the users or groups that are allowed to log into the local computer. This policy can be found in Computer Configuration > Policies > Security Settings > Local Policies > User Rights Assignment > Allow log on locally.
Allow log on locally Properties
Allow log on locally Properties
In my example, I’ve included the local workstation Administrators group, Domain Admins, and an AD group called “Allow Computer Logons.” With this configuration, only user accounts that are members of the local Admins group on the computer or one of the two AD groups are allowed to log in. Just as a reference, here is the default configuration for Windows 7:
Allow Log on locally Properties in Windows 7
Allow Log on locally Properties in Windows 7
If you happen to be a user that is not authorized to use a computer, here is the message the user will see on Windows XP:
The local policy of this system does not permit you to logon interactively
The local policy of this system does not permit you to logon interactively
And here is the error message they will see on Windows Vista or 7 (the message is the same for both except for the OS name):
You cannot log on because the logon method you are using is not allowed on this computer
You cannot log on because the logon method you are using is not allowed on this computer.

Tips ^

The Group Policy Management Console references Microsoft Knowledge Base article Q823659for the Allow log on locally setting. Despite the old-style “Q” naming convention that is referenced, the article is fairly current and still applies to the newer versions of Windows. The KB article gives several examples of harmful configurations and a few more justifications for why you should consider using these two settings.

  • Here are a few things to keep in mind if you decide to implement these settings:
  • DO NOT apply them to Domain Controllers.
  • DO NOT put the settings into either of the default GPO’s for Default Domain Policy or Default Domain Controllers Policy.
  • Deny trumps allow. If a user is in both Allow log on locally and Deny log on locally, Deny always wins.
  • Be on the lookout for software that creates local service accounts that need to be included in Allow Log on Locally. For instance, VMware Workstation and VMware Player have functionality that will not work unless the service account they create is included in Allow Log on Locally.
  • Only apply these settings to sub-sets of computers and not the entire Domain.
reference: https://4sysops.com/archives/deny-and-allow-workstation-logons-with-group-policy/

August 19, 2016

Hướng dẫn cài đặt VirtualBox version 5.0.14 dùng làm máy ảo làm lab

Cài đặt VirtualBox và các thành phần bổ sung cần thiết:

Trang chủ VirtualBox: http://www.virtualbox.org/
Phiên bản mới nhất thời điểm hiện tại (19/08/2016) là 5.1.4
Download: https://www.virtualbox.org/wiki/Download_Old_Builds_5_1
Bài viết này mình sẽ hướng dẫn cài đặt version 5.0.14 dành cho phiên bản Windows , các phiên bản khác làm tương tự.
Tải về VirtualBox 5.0.14 dành cho Windows (32-bit và 64-bit) – dung lượng 112 MB:
và download gói VirtualBox Extension Pack kèm theo bước 2

1.Cài đặt VirtualBox
Kích hoạt file VirtualBox-5.0.14-105127-Win.exe để tiến hành cài đặt. nhấn Next



Giữ nguyên các thiết lập cài đặt mặc định, nhấn Next để tiếp tục, muốn thay đổi thư mục cài đặt  nhấn vào Browse.


Nhấn Next để tiếp tục.


Chọn Yes để tiếp tục


Nhấn Install để bắt đầu quá trình cài đặt.


Quá trình cài đặt đang chạy



Cài đặt thành công, nhấn Finish để khởi chạy VirtualBox.



2. Cài đặt VirtualBox Extension Pack

Để máy ảo có thể sử dụng USB 2.0, tính năng VirtualBox Remote Desktop Protocol, Intel PXE boot ROM cần cài đặt VirtualBox Extension Pack. Tải về VirtualBox 5.0.14 Oracle VM VirtualBox Extension Pack – dung lượng 16.1 MB tiến hành cài đặt nhấn install :


Kéo thanh trượt xuống dưới cùng chọn I Agree


Nhấn OK để finish


Sau khi cài xong mở Vitualbox Manager lên thưởng thức


Enjoy!



August 18, 2016

How to Block Advertisements in Skype


Method 1: Block root advertisement app source via Internet Explorer
Step 1: Head to the Control Panel and click on Internet Options


Step 2: Click on the Security tab and select the Restricted Sites icon.

Step 3: Press the Sites button and type https://apps.skype.com in the text box, then press Add ==> OK


Method 2: Block Ads via config.xml file

Step 1 : Press Windows+R and type %appdata % go to \Skype\[your Skype username]


Step 2: You should see a config.xml file in this directory. Right-click it and choose Edit, then Ctrl+F to find the line that says <AdvertPlaceholder> and delete the entire line. Make sure to save your changes to the file before exiting.

Method 3: Block ad servers via Hosts file in Windows (warning: a bit technical)
Step1. Press Windows+R and type C:\Windows\System32\drivers\etc\hosts
Step 2. Add the lines below:
127.0.0.1 rad.msn.com
127.0.0.1 live.rads.msn.com
127.0.0.1 ads1.msn.com
127.0.0.1 static.2mdn.net
127.0.0.1 g.msn.com
127.0.0.1 a.ads2.msads.net
127.0.0.1 b.ads2.msads.net
127.0.0.1 ac3.msn.com
Step 3. Save and restart your Skype app.

Done!