jesterj@jesterj-laptop:~$ tar zcvf - donkey* | ssh jesterj@donkey.dnsdojo.com “cat > ~/testarchive3.tar”By far the easiest way to tar a file and send it to a remote location is to simply have two commands on one line. The first to create the tar file, the other to scp the command. In this example, I am not prompted for a passphrase since i have my ssh key saved on the remote server for this user.
Easy:
jesterj@jesterj-laptop:~$ tar -cvf testarchive.tar donkey*; scp testarchive.tar jesterj@remoteserver:~
donkey
donkey1.zip
donkey2.txt
donkey2.zip
donkey.tar
donkey.txt
testarchive.tar 100% 20KB 20.0KB/s 00:00
jesterj@jesterj-laptop:~$
Pipe the file…More complicated:
jesterj@jesterj-laptop:~$ tar zcvf - donkey* | ssh jesterj@donkey.dnsdojo.com "cat > ~/testarchive3.tar"
source: http://www.cyberciti.biz/faq/howto-use-tar-command-through-network-over-ssh-session/
Linux, Networking
In ubuntu there is program called apparmor that verifies certain programs are configured appropriately, mysql included. Just recently the partition that holds all the data (/var/lib/mysql) filed up. Since I was at 100% and this is a production box I needed to fix this quickly. My options were as follows:
1. Setup a sym link from /var/lib/mysql to /home/mysql, move data here OR
2. Simply create a new dir call /home/mysql, move data here
To do this edit /etc/mysql/my.cnf
...
datadir =/home/mysql
#datadir = /var/lib/mysql
...
Save the file and restart mysql and you will get the following error:
root@slave:/etc/mysql# /etc/init.d/mysql2 start
* Starting MySQL database server mysqld [fail]
The problem here is that apparmor is dissallowing mysql from running in any other location than /var/lib/mysql. You will need to edit the apparmor file for mysql.
root@slave:/etc/apparmor.d# grep "/var/lib/mysql" usr.sbin.mysqld
/var/lib/mysql/ r,
/var/lib/mysql/** rwk,
To correct this problem replace all instances of /var/lib/mysql with /home/mysql. Open the file with file and do a search and replace. See that I am escaping the slashes!
:%s /\/var\/lib\/mysql/\/home\/mysql/
Reload appamor and mysql should start up with the new config in your my.cnf file!
root@slave:/etc/apparmor.d# /etc/init.d/apparmor restart
Reloading AppArmor profiles : done.
root@slave:/etc/apparmor.d# /etc/init.d/mysql2 start
* Starting MySQL database server mysqld
Networking, Uncategorized
sudo tcpdump -n -i eth0 -s 0 -w output.txt src or dst port 80
Networking, Uncategorized
Using urllib…
#!/usr/bin/python
import urllib
c=urllib.urlopen('http://nike.com')
print c.getcode()
200
or try with httplib…
#!/usr/bin/python
import httplib
conn = httplib.HTTPConnection("www.python.org")
conn.request("GET", "/index.html")
r1 = conn.getresponse()
print r1.status
200
Networking, Uncategorized
Install iperf
apt-get install iperf
Listen on machine #1
$ iperf -s -P 2 -i 5 -p 5999 -f M
Send packets on machine #2
iperf -c backupserv -P 1 -i 5 -p 5999 -f M -t 60 -T 1
Results:
————————————————————
Client connecting to backupserv, TCP port 5999
TCP window size: 0.02 MByte (default)
————————————————————
[ 3] local 192.168.1.5 port 49711 connected with 192.168.1.3 port 5999
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 5.0 sec 562 MBytes 112 MBytes/sec
[ 3] 5.0-10.0 sec 562 MBytes 112 MBytes/sec
[ 3] 10.0-15.0 sec 561 MBytes 112 MBytes/sec
[ 3] 15.0-20.0 sec 561 MBytes 112 MBytes/sec
[ 3] 20.0-25.0 sec 562 MBytes 112 MBytes/sec
[ 3] 25.0-30.0 sec 561 MBytes 112 MBytes/sec
[ 3] 30.0-35.0 sec 561 MBytes 112 MBytes/sec
[ 3] 35.0-40.0 sec 561 MBytes 112 MBytes/sec
[ 3] 40.0-45.0 sec 561 MBytes 112 MBytes/sec
[ 3] 45.0-50.0 sec 561 MBytes 112 MBytes/sec
^C[ 3] 0.0-50.8 sec 5707 MBytes 112 MBytes/sec
Linux, Networking, Uncategorized
Networking
Problem: I have an airport express in my basement but my xbox is located upstairs. I want to avoid running wire upstairs as well as purchasing the $80 wireless adapter for the xbox. Since i have a spare airport express i want to set this up in brigding mode. It does work but there are quite a few steps. See below:
How to configure airport xpress with Xbox
- Setup main base station to work correctly
- Set channel to ‘1′ or the same on both.
- Get the airport id from each wireless unit (not the WAN id) - you will need this later.
- On the airport for the xbox make sure you have these settings;
- Wireless Mode: Create Wiresless Network (home router)
- Connect using: Airport (WDS)
- Mac Address: (enter the mac for the main base station)
- Configure: Using DHCP
- Under WDS Table
- enable this base sataion as ‘remote base stations’
- Enter airport ID for main base station.
- On the main base station go to the WDS tab
- enable as main base station
- add mac address of xbox airport express
Update both and restart!
Networking, Uncategorized