dd bs=1M count=512 if=/dev/zero of=test conv=fdatasync
The result is something like this :
512+0 records in
512+0 records out
536870912 bytes (537 MB) copied, 1.43334 s, 375 MB/s
dd bs=1M count=512 if=/dev/zero of=test conv=fdatasync
The result is something like this :
512+0 records in
512+0 records out
536870912 bytes (537 MB) copied, 1.43334 s, 375 MB/s
First you need to make sure you have the latest version of wget, some distros are still being released with older versions of wget which has some bugs regarding mirroring functionality. currently the latest version is 1.13.4, so if you don’t have the latest version, you can download and build it from following link :
ftp://ftp.gnu.org/gnu/wget/
after building the wget, make sure the latest version is being used :
wget -V
output :
GNU Wget 1.13.4 built on linux-gnu.
+digest +https +ipv6 -iri +large-file +nls -ntlm +opie +ssl/gnutls
Wgetrc:
/usr/local/etc/wgetrc (system)
Locale: /usr/local/share/locale
Compile: gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/usr/local/etc/wgetrc"
-DLOCALEDIR="/usr/local/share/locale" -I. -I../lib -I../lib -O2
-Wall
Link: gcc -O2 -Wall -lgnutls -lgcrypt -lgpg-error -lz -lrt ftp-opie.o
gnutls.o ../lib/libgnu.a
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://www.gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Originally written by Hrvoje Niksic <hniksic@xemacs.org>.
Please send bug reports and questions to <bug-wget@gnu.org>.
OK, you are good to go now, just execute the following command and relax
wget -mkp -e robots=off http://site
As simple as one single command :
find -type d -empty -delete
Theoretically host IP and gateway should be on the same IP subnet. but there are some situations where host IP and gateway subnet are on different subnets. like my situation today. I was assigned two additional IPs for my server by my Data-center, but IPs were from a different subnet compared to server main IP. these IPs will work if you set them as additional IPs. but I needed them to create two new VPS’s on my server with bridged network interface. in this situation additional IPs should serve as main IP address and there is no gateway on same subnet available.
So here are the assumptions :
a.b.c.d is the host IP
e.f.g.h is the gateway IP
a.b.c.d & e.f.g.h are on different subnets.
by default if you try to set gateway by following command :
route add default gw e.f.g.h
you will get this error :
SIOCADDRT: No such process
the trick is simple , first add a route to default gateway itself and then set the default gateway , like this :
route add e.f.g.h/32 dev eth0 route add default gw e.f.g.h
remember you may need to change eth0 to your device name , it may be eth1 or wlan0 or anything.
How to make these route changes persistent ?
For Debian/Ubuntu :
Add the following lines to /etc/network/interfaces :
post-up route add e.f.g.h/32 dev eth0 post-up route add default gw e.f.g.h
Normal Redirect: command > filename Redirect command output to a file command >> filename APPEND into a file command < filename Type a text file and pass the text to command commandA | commandB Pipe the output from commandA into commandB commandA & commandB Run commandA and then run commandB commandA && commandB Run commandA, if it succeeds then run commandB commandA || commandB Run commandA, if it fails then run commandB Numeric handles: STDIN = 0 Keyboard input STDOUT = 1 Text output STDERR = 2 Error text output UNDEFINED = 3-9 command 2> filename Redirect any error message into a file command 2>> filename Append any error message into a file command > file 2>&1 Redirect errors and output to one file command > file 2<&1 Redirect output and errors to one file command > fileA 2> fileB Redirect output and errors to separate files command 2>&1 >filename This will fail! Redirect to /dev/null (hide errors): command 2> /dev/null Redirect error messages to /dev/null command >/dev/null 2>&1 Redirect error and output to /dev/null command >filename 2> /dev/null Redirect output to file but suppress error
Source : ss64.com
After my previous article which explained how to backup MySQL DBs to an email address , I am going to provide a more perfect solution in this article ![]()
The previous solution had some drawbacks and some advantages but the biggest problem was about the size of backup. although we compress the data with bzip2 algorithm which provides a high level of compression but in many cases, the attachment size will exceed 25MB or the limit of your email box. so it can not be used with public email services or will need a personal email server.
a better solution is to backup the data to a remote FTP server. in this case we will have almost no limit on file size (depending on your remote FTP server).
A perfect place to backup your files is fileserve.com , it offers 500GB of space for free and FTP access to it ! it is awesome ! I would recommend to upgrade to their premium service.
click on this link to signup for your free account : FileServe.com Free Account
also we will employ encryption to make sure our data is safe in transmit and in remote location.
to use this solution make sure bzip2, mcrypt and ncftp are installed on your server. I am not going into the details of installing each package, Google is your friend ![]()
so lets say you want to backup /var/www folder, use the following command :
tar jcf - /var/www | mcrypt -k 'SOME_LONG_COMPLEX_KEY' | ncftpput -c -u FTP_USER -p FTP_PASS FTP_HOST /PREFIX-`date +%Y%m%d`
this only command will compress the whole /var/www folder by tar and bzip2 at the same time encrypt it by your key and at the same time will upload it to remote FTP server !
omg ! thats why I love Linux ! you can put it in your crontab to create automatic backups.
now lets say you want to backup all MySQL DBs , you can use the following command :
mysqldump --user=USERNAME --password=PASSWORD -A | bzip2 | mcrypt -k 'SOME_LONG_COMPLEX_KEY' | ncftpput -c -u FTP_USER -p FTP_PASS FTP_HOST /PREFIX-`date +%Y%m%d`
the combinations and possibilities are limitless !
I just gave you the idea and showed you the power, use your own brain to make your perfect solution ![]()
Just something else , if you needed to decrypt the file , you can use the following command :
mcrypt -d FILE_NAME -k 'YOUR_LONG_COMPLEX_KEY' > NEW_FILE_NAME
Make sure mutt & bzip2 are installed on your server.
Change USERNAME & PASSWORD to your MySQL login credentials.
Change email@domain.com to your email which can accept large attachments (gmail is recommended, currently it accepts attachments up to 25MBs)
Put the following line in your crontab. you can access crontab by this command : crontab -e
0 0 * * * mysqldump --user=USERNAME --password=PASSWORD -A | bzip2 > ~/AllDBsBackup.bz2 && echo | mutt -a ~/AllDBsBackup.bz2 -s "All DBs Daily Backup" -- email@domain.com
The following script will block and log un-encrypted BitTorrent & DHT traffic on your Linux firewall.
I have personally tested it on debian 5 lenny , but I am almost sure it should work pretty well on any new Linux distros.
iptables -N LOGDROP > /dev/null 2> /dev/null iptables -F LOGDROP iptables -A LOGDROP -j LOG --log-prefix "LOGDROP " iptables -A LOGDROP -j DROP #Torrent iptables -A FORWARD -m string --algo bm --string "BitTorrent" -j LOGDROP iptables -A FORWARD -m string --algo bm --string "BitTorrent protocol" -j LOGDROP iptables -A FORWARD -m string --algo bm --string "peer_id=" -j LOGDROP iptables -A FORWARD -m string --algo bm --string ".torrent" -j LOGDROP iptables -A FORWARD -m string --algo bm --string "announce.php?passkey=" -j LOGDROP iptables -A FORWARD -m string --algo bm --string "torrent" -j LOGDROP iptables -A FORWARD -m string --algo bm --string "announce" -j LOGDROP iptables -A FORWARD -m string --algo bm --string "info_hash" -j LOGDROP # DHT keyword iptables -A FORWARD -m string --string "get_peers" --algo bm -j LOGDROP iptables -A FORWARD -m string --string "announce_peer" --algo bm -j LOGDROP iptables -A FORWARD -m string --string "find_node" --algo bm -j LOGDROP
This error is caused by the improper configuration of hostname of server. to fix it follow the steps below :
Change HOST.DOMAIN.com to your own hostname.
echo HOST.DOMAIN.com > /etc/hostname /bin/hostname -F /etc/hostname /etc/init.d/httpd restart
Powered by WordPress