Saturday, March 29, 2014

unzip multipal zip files

Use below command to unzip multipal zip files:

#unzip '*.zip'

Sunday, March 9, 2014

Send Email from a PHP Script Example

Send Email from a PHP Script Example

To send a simple sample message, we could use:


Email successfully sent!
");  } else {   echo("Email delivery failed…
");  } ?>

Remove session files under /tmp weekly

Remove session files under /tmp weekly


root@host [/scripts]# ll | grep cleanup.sh
-rwxr-xr-x  1 root root      39 Nov 21 10:41 cleanup.sh*
root@host [/scripts]# cat cleanup.sh
find /tmp/  -name "sess_*" | xargs rm

root@host [/scripts]#
================================
weekly on sunday 1 PM
00 1 * * 7  /scripts/cleanup.sh
================================

create cpanel backup without public_html and without database

# /scripts/pkgacct  --skiphomedir --skipacctdb  CPANEL_USER

Find command


Recursive chmod only files within this folder:

find . -type f -exec chmod 0644 {} \;

Recursive chmod only folders within this folder:

find . -type d -exec chmod 0755 {} \;

into a bash script, so it could be something like:

For files:

rchmodf 744 .

For directories:

rchmodd 755 .

and... also maybe into a nautilus right click menu option if that's possibl

How to check for mod_rewrite is enabled or not.

How to check for mod_rewrite is enabled or not.

1- First of all create an empty file and name it test.html (or what you want) and upload this file on you hosting server.
# touch test.html

2- Create a .htaccess file and put the following code into it. (create htaccess.txt file )
#touch .htaccess
-------------------------

RewriteEngine On
Options +FollowSymLinks
RewriteRule ^test\.html http://www.google.com/? [R=301,L]
------------------------
Note: On windows machine first create htaccess.txt file, then adds the above code into it, upload on server, after uploading remove the .txt extension.

3- Now run this URL into your browser http://www.domain-name.com/test.html (replace domain-name.com with your actual domain name).

If it redirects you on google.com then "mod_rewrite" is working on your server host, if it is not, shows you a blank file means mod_rewrite is not working.

4- If your site runs in some folder then adds the folder name before test.html and uploads the htaccess file in the root folder. Eg
-------------------------

1
2
3
RewriteEngine On
Options +FollowSymLinks
RewriteRule ^foldername/test\.html http://www.google.com/? [R=301,L]
-------------------------