Archive for the ‘server’ Category

TAR command

Thursday, March 11th, 2010 by dreamluverz

create:
tar -cvf mystuff.tar mystuff/
tar -czvf mystuff.tgz mystuff/
extracting:
tar -xvf mystuff.tar
tar -xzvf mystuff.tgz
testing/viewing:
tar -tvf mystuff.tar
tar -tzvf mystuff.tgz

Note that .tgz is the same thing as .tar.gz
Tar “tars up” a bunch of files into one “tar-file”
gzip is compression, but only works on one file, so the entire “tarfile” is compressed.

Also when creating a tar or cpio backup, never, never, never use an “absolute” path — you have been warned; also linux tar warns you of this too. The problem is that when you want to unpack, you cannot choose where to unpack to, you will be forced to unpack to the “same” absolute path. When creating a tar or cpio you should change the the appropriate directory and tar from there.

Also when creating a tar or cpio it is general good practice to tar up a directory (appropriately named) which contains your files, rather than just the files. This is good courtesy to anyone unpacking your tarfile.

If you would like to create a tar file while saving ownership and permissions, add the “p” flag.

Creating and saving ownership and permissions:
tar -cpvf mystuff.tar mystuff/
tar -cpzvf mystuff.tgz mystuff/

Also take note of the following commands:
gzip
gunzip
cat
zcat
bzcat
bzip2
bunzip2
zgrep
bzgrep

(cd /mydir && tar -czf – .)|(cd /destdir && tar -xzvf -)
tar -czf – . | ssh user@dest “(cd /destdir && tar -xzvf -)”
(cd /mydir && tar -czf – .) | ssh user@dest “(cd /destdir && tar -xzvf -)”





Errors:
If you receive an error such as the following:

[root@localhost test]# ssh user@dest "(cd /rh62/home/kernel && tar -czvf - linux-2.2.22.tar.bz2)"|tar -xzvf -
user@dest's password:
linux-2.2.22.tar.bz2
linux-2.2.22.tar.bz2

gzip: stdin: decompression OK, trailing garbage ignored
tar: Child returned status 2
tar: Error exit delayed from previous errors
[root@localhost test]#

Then try leaving off the compression as follows:

[root@localhost test]# ssh user@dest "(cd /rh62/home/kernel && tar -cvf - linux-2.2.22.tar.bz2)"|tar -xvf -
user@dest's password:
linux-2.2.22.tar.bz2
linux-2.2.22.tar.bz2
[root@localhost test]# echo $?
0
[root@localhost test]#

Spaces in your filenames?
Having fun with spaces in the filename or directory name? Here’s your answer:

find . -type f -name '*jpg' | grep " " | while read REPLY; do
     tar -cf - "$REPLY" | (cd /tmp/jpg && tar -xvf -)
done

Bonus:

find . -type f | while read REPLY; do
     cp -a "$REPLY" /tmp/jpg/`echo $REPLY \
       | sed -e 's/ //g' -e 's/\///g' -e 's/^\._//'`
done

ssh root@dest 'tar -C / -czf - --exclude ./proc/* --exclude ./dev/pts/* .' > gmaster.tgz
proc and dev was empty for the following command, so I didn't exclude them:
tar -czf - . | ssh user@dest "cat - > k12ltsp.master.tgz"

source: http://roffle.us/blog/archives/13-Linux-TAR-Command.html

what is SOAP

Monday, June 15th, 2009 by dreamluverz




How is SOAP Used?
There are many possible applications for SOAP, here are just a couple:

  • Business to Business integration – SOAP allows businesses to develop their applications, and then make those applications available to other companies
  • Distributed applications – programs like databases could be stored on one server and accessed and managed by clients across the Internet

One thing to consider when looking into implementing SOAP on your business server is that there are many other ways to do the same thing that SOAP does. But the number one benefit you’ll gain from using SOAP is it’s simplicity. SOAP is just XML and HTTP combined to send and receive messages over the Internet. It is not constrained by the application language (Java, C#, Perl) or the platform (Windows, UNIX, Mac), and this makes it much more versatile than other solutions.

source: webdesign.about.com/library/weekly/aa031802a.htm

cannot send out mails

Tuesday, May 12th, 2009 by dreamluverz

For some reasons I cannot send out mails using the mail() in php and even trying out any other phpmailer and it only happens with my own domain name but when tyring to send mail to gmail.com it went through.

Btw, to give you more background about the issue, I’ve been using the gmail web email application for my domain mail accounts. I changed the MX record as advised by gmail to point all emails to their server. When using the gmail app for sending and receiving mails for my domain there’s no problem at all BUT when trying out my codes for some website hosted in my domain the mail() didn’t work or any php mailer functions.

Here’s an example: php code running on my website

mail(“myact@mydomain.com”, $sub, $msg, $header);  not working but

mail(“myact@gmail.com”, $sub, $msg, $header); it went through.

I’m getting an error saying myact@mydomain.com is not a valid email account and cannot find that user.

SOLUTION

So I checked the settings on MX record again, I’m using cpanel btw, then I noticed the column ALWAYS ACCEPT for my domain set to YES, so changed it to NO and tried sending mail again AND THIS TIME IT WENT THROUGH.

I remembered when setting up the MX record when trying to point my domain mail accounts to gmail I had this setting Always accept mail locally even if the primary mx does not point to this server. set to yes so remember to SET IT TO NO!

domain redirection

Tuesday, May 20th, 2008 by dreamluverz

As far as SEO is concerned 301 redirect is the most effecient way of domain redirection.

Some ways of doing it:

PHP Redirect

<?
Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location: http://www.new-url.com” );
?>

.htaccess

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

Check out here for other languages

other reference : http://www.somacon.com/p145.php

error 500

Thursday, May 8th, 2008 by dreamluverz

problem: error 500 on xampp when using htaccess:
solution: Locate this file httpd.conf and uncomment this LoadModule mod_rewrite modules/mod_rewrite.sop and restart apache

Error: invalid argument to date encode in nusphere

Friday, February 29th, 2008 by dreamluverz

I’m getting this error at this moment. And also these guys on this site:http://forum.pspad.com/read.php?2,45078,45079.  What could be the problem. Please help us…