The Blog

Author: admin

Slick way to deal with 301 and 302 from Ajax call.

Posted on

On the Server side response with similar code:

header('HTTP/1.0 278 Ok');
echo json_encode(array('redirect' => "/"));
exit;

In JQuery bind AjaxSuccess to this function. Somewhere in a global header or layout page, so it get accesses from all pages.

$('body').bind('ajaxSuccess',function(event, request, settings){
if (request.status == 278){
jsonresponse = $.parseJSON(request.responseText);
$('form').dirtyForms('setClean');
window.location.href = jsonresponse.redirect;
}
});
Posted in PHP Leave a comment

RSYNC over ssh with sudo to preserve permissions and ownership

Posted on

See this post first as it’s the first step to this setup:
Steps to Perform SSH Login Without Password Using ssh-keygen & ssh-copy-id

#sudo visudo on the terget box

at the bottom add:

username_that_logs_in_to_ssh_from_source ALL=NOPASSWD: /usr/bin/rsync

to your rsync command add:

--rsync-path="sudo rsync"

full example:

rsync -avz --delete --rsync-path="sudo rsync" /var/www/sites/ target_host:/var/www/sites/
Posted in Linux 1 Comment

Plesk email password utilitys

Posted on

To find password for a single email  account

root@server[#] /usr/local/psa/bin/mail –info [email protected]

To find all email account passwords for a single domain

root@server[#] /usr/local/psa/admin/bin/mail_auth_view | grep domain.com

The below command will list passwords for all email accounts in plesk.

root@server[#] /usr/local/psa/admin/bin/mail_auth_view

On older PLESK try

# /usr/local/psa/admin/bin/mail_auth_view

Posted in PLESK Leave a comment
« Previous PageNext Page »