IMPORTANT!

Snipt is going open source. We've toyed with this idea for quite a while, and have finally decided it's the right way to move forward.

A few things:
  • The entire Snipt source code will be released on GitHub under the 3-clause BSD License on Friday, September 10th.
  • While we'd like to think we're perfect, we realize we're only human. By open sourcing the software that runs this website, certain bugs or security flaws may be discovered that could compromise the privacy of your snipts.
  • Only the Lion Burger team will be able to push commits to the Snipt.net site. Contributors should send a pull request to add new features or submit patches.
  • By using this site, you agree not to be too angry or take any legal action against Lion Burger should this whole thing go up in flames some day.
  • Follow us on Twitter for updates.
I agree, close this message
Sign up to create your own snipts, or login.

Latest 100 public snipts » plesk The latest public plesk snipts.

showing 1-20 of 28 snipts for plesk
  • HOW TO: FIX A BROKEN PLESK BACKUP
    #To fix a broken Plesk backup, you follow these steps to fix the stuck process. This must #be done from SSH logged in as root.
    
    #The first thing to try is to look for any running backups that may be hung:
    
    mysql -u admin -p`cat /etc/psa/.psa.shadow`
    mysql>use psa;
    mysql>select * from BackupsRunning;
    
    #If there are any entries in here, they can be removed.  Dates older than at least three #days are a good sign a backup process is hung and causing the error. To remove currently #running backups:
    
    mysql>delete from BackupsRunning; 
    
    #Another option is to clear the backup jobs from the plesk database.  This will remove all #scheduled backups and the client will need to re-create their backup jobs. 
    
    mysql -uadmin -p`cat /etc/psa/.psa.shadow`
    mysql> use psa;
    mysql>select * from BackupsSettings;
    mysql> delete from BackupsSettings;
    
    #This will remove all the backup settings and will have the initial backup configuration - an empty set. These steps should clear any errors with the plesk backups.
    

    copy | embed

    0 comments - tagged in  posted by toberlander on Jun 08, 2010 at 3:01 p.m. EDT
  • Force plesk stat update
    /usr/local/psa/admin/sbin/statistics --calculate-one --domain-name=<domain>
    

    copy | embed

    0 comments - tagged in  posted by mdylanbell on Apr 27, 2010 at 3:51 p.m. EDT
  • SSL Cert showing self-signed fix
    cp /etc/httpd/conf.d/ssl.conf /etc/httpd/conf.d/ssl.conf.old && vi +/VirtualHost +\:\.\,\$\ s\/\^\/\#\/g +\:x /etc/httpd/conf.d/ssl.conf && service httpd restart
    

    copy | embed

    0 comments - tagged in  posted by techlyc on Apr 05, 2010 at 4:29 p.m. EDT
  • reconfigure plesk vhost
    /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=<NOME_DOMINIO>
    

    copy | embed

    0 comments - tagged in  posted by ftassi on Mar 12, 2010 at 12:44 p.m. EST
  • kmemsize limit explanation
    Adding the additional ram may help with privvmpages, however, because kmemsize deals exclusively with kernel memory you will likely not see a difference with the additional ram. The only solution you have to correct the kmemsize error is to optimize so that your server consumes less kernel memory. However, as you pointed out you have already gone through this process. At this point the only real option you have is to increase your kernel memory by upgrading to the next level of (dv) Dedicated-Virtual server such as Rage or Extreme. If you have any further questions regarding your (mt) Media Temple services, please feel free to contact us at any time.
    

    copy | embed

    0 comments - tagged in  posted by abecker on Dec 28, 2009 at 4:56 p.m. EST
  • Mediatemple (dv) server - Plesk & Apache restart
    /usr/local/psa/admin/sbin/websrvmng -a -v
    

    copy | embed

    0 comments - tagged in  posted by erincarter on Nov 15, 2009 at 12:37 a.m. EST
  • Mailbox Plesk Diskusage
    cd /var/qmail/mailnames/; du -sh */*
    

    copy | embed

    0 comments - tagged in  posted by AvidDeville on Oct 20, 2009 at 1:48 p.m. EDT
  • Reconfigures vhost entries
    /usr/local/psa/admin/sbin/websrvmng -av
    

    copy | embed

    0 comments - tagged in  posted by malkir on Sep 30, 2009 at 6:01 p.m. EDT
  • Configuring Linux Plesk to drop external MySQL connections
    Taken from http://www.europheus.com/?p=64
    
    By default, your MySQL server can be wide open to the internet accepting connections from everyone. With some brute force and bad passwords on your part, there will be a hack party in your database. The best thing to do is to block all external connections to your MySQL port (3306) and allow only internal (localhost) connections. This will allow your web applications to continue to run while rejecting all outsiders. And if needed, you can allow one or more external static IPs to connection, however this is not addressed here.
    
    Using the Plesk firewall module is one way to block external connections, however it is simply a lame web interface to the iptables command. The best way to block external connections is to run the following commands as root.
    
        # this command makes sure everything on localhost works
        iptables -A INPUT -p all -s localhost -d localhost -j ACCEPT
        # block all external connection attempts to MySQL
        iptables -A INPUT -p tcp –destination-port 3306 -j REJECT
        /etc/init.d/iptables save
        /etc/init.d/iptables restart 
    
        #check the new definitions
        iptables –list
    
        Chain INPUT (policy ACCEPT)
        target prot opt source destination
        ACCEPT all — localhost.localdomain localhost.localdomain
        REJECT tcp — anywhere anywhere tcp dpt:mysql reject-with icmp-port-unreachable
    
        Chain FORWARD (policy ACCEPT)
        target prot opt source destination
    
        Chain OUTPUT (policy ACCEPT)
        target prot opt source destination 
    
    You can test your work from another server by running: nmap 
    

    copy | embed

    0 comments - tagged in  posted by bhubbard on Jun 04, 2009 at 12:01 p.m. EDT
  • Upgrading Spamassassin on Plesk servers
    #Found at http://www.europheus.com/?p=59
    
    Upgrading Spamassassin on a Plesk server is not difficult and can take only a few minutes. This example describes upgrading from Spamassassin version 2.64 to version 3.1.7 on Plesk 7.5
    
    To get the current version of Spamassassin on your server type:
    
        spamassassin –version
    
    To get the latest version of Spamassassin go here http://spamassassin.apache.org/
    
    Once you have downloaded the tar or zip file, unzip / untar the archive on your server and execute the following commands.
    
        cd Mail-SpamAssassin-*
        perl Makefile.PL
        [option: add -DSPAMC_SSL to $CFLAGS to build an SSL-enabled spamc]
        make
        make install [as root]
    
    While in the Mail-SpamAssassin directory, you should run the included tests. These tests will let you know if you are missing any modules or if the versions are too old.
    
        spamassassin -t < sample-nonspam.txt > nonspam.out
        spamassassin -t < sample-spam.txt > spam.out 
    
    Here you may see warnings for several items, for example IO::Socket::INET6 Simply enter this into google and you should find the module to download. These are usually .tar files and you simply untar them and follow the instructions in the README or related text files.
    
    Next you will need to modify the startup script to deal with commandline parameter changes.
    
    Edit the file /etc/init.d/spamassassin and find SPAMDOPTIONS
    Remove the parameter –a and save the file.
    
    Next you will need to modify configuration scripts to deal with changes.
    
    Edit the file /etc/mail/spamassassin/local.cf
    Comment out (or delete) the rewrite_subject and subject_tag fields and replace them with the rewrite_header field.
    
        required_hits 7
        # rewrite_subject 1
        # subject_tag *****SPAM*****
        rewrite_header Subject ****SPAM(_SCORE_)****
        report_safe 0 
    
    Next you will need to make the same changes for each mailbox that has it’s own config file. Check for the user_prefs file in each mailbox for each domain.
    
    /var/qmail/mailnames/domainname/mailname/user_prefs
    
    Finally you should restart spamassassin
    
    /etc/init.d/spamassassin restart
    /etc/init.d/psa-spamassassin restart
    

    copy | embed

    0 comments - tagged in  posted by bhubbard on Jun 04, 2009 at 12:00 p.m. EDT
  • Script to find domains which have mail enabled, then disable them
    #!/bin/bash
    # This script finds all sites that have the mail service on - and then it turns it off.
    
    SiteList=`egrep 'Server(Name)' /var/www/vhosts/*/conf/httpd.include|awk '{print $3}'|grep -v www.*|grep -v '^.*\..*\..*$'|sed 's/:80//'|sed 's/:443//'|sort -u`;
    
    for Site in $SiteList
    do
    Result=`/usr/local/psa/bin/domain -i $Site | grep 'Mail service' | awk '{print $3}'`;
    if [ $Result == On ]; then
    Command=`/usr/local/psa/bin/domain -u $Site -mail_service false`
    echo "Turning Off Mail Service: $Site";
    fi
    done
    

    copy | embed

    0 comments - tagged in  posted by bhubbard on Jun 04, 2009 at 11:56 a.m. EDT
  • plesk doesnt recognize ssl certificate
    cd /etc/httpd/conf.d/; cp ssl.conf ssl.conf.old && sed '/VirtualHost/,$  s/^/#/'  ssl.conf.old > ssl.conf && service httpd restart
    

    copy | embed

    0 comments - tagged in  posted by malkir on May 25, 2009 at 1:01 a.m. EDT
  • Rebuild Plesk Statistics
    /usr/local/psa/admin/sbin/statistics –calculate-all
    

    copy | embed

    0 comments - tagged in  posted by JoeBiellik on Mar 26, 2009 at 5:13 p.m. EDT
  • Read Plesk user password
    mysql -uadmin -p`cat /etc/psa/.psa.shadow` -e "use psa; select accounts.password from accounts INNER JOIN sys_users ON   accounts.id=sys_users.account_id WHERE sys_users.login='xxxx';"
    

    copy | embed

    0 comments - tagged in  posted by JoeBiellik on Mar 26, 2009 at 12:13 p.m. EDT
  • Joomla, Plesk Permissions
    #!/bin/bash
    # This script makes it easier to get domain directory permissions to work well with Joomla
    
    # First check that this is a valid username
    grep "^${1}:" /etc/passwd > /dev/null 2>&1
    if [ "$?" -ne "0" ]; then
    echo "Sorry, cannot find user ${1} in /etc/passwd or you didn't supply a username"
    echo "Usage: ${0} "
    
    exit 1
    fi
    
    userdir=`grep "^${1}:" /etc/passwd | cut -d: -f6`
    
    if [ -d ${userdir} ] ; then
    echo "Changing to directory ${userdir}"
    cd ${userdir} && chown -R ${1}:psacln httpdocs && chmod -R g+w httpdocs && find httpdocs -type d -exec chmod g+s {} \; && /etc/init.d/httpd reload
    fi
    

    copy | embed

    0 comments - tagged in  posted by bhubbard on Mar 17, 2009 at 10:07 a.m. EDT
  • RSYNC/SED script to mirror a Plesk host
    #!/bin/bash
    # RSYNC/SED script to mirror a Plesk host
    # 2007­08­01 Ben Johns
    
    # Requirements:
    # SSH Pub/Priv keys shared on both hosts
    # ssh­keygen ­-t dsa ­-b 1024 ­-f `whoami`-­`hostname` (NO PASSPHRASE!)
    # copy the resultant .pub file to the remote host and append it too
    # the RSYNC_USER's .ssh/authorized_keys file.
    # RSYNC Version >2.6.3
    # HTTPD.INCLUDE needs to be manually configured to suit the config
    # of the local host. Ie copy the relevant sections from the remote hosts
    # plesk httpd conf to this host. Usually done somewhere in /etc/httpd or /etc/apache.
    
    # REM_HOST: The remote host to mirror
    # RSYNC_USER: The user account on the remote host that has permission
    # to copy the intended files.
    # RSYNC_OPTS: Parameters to use with the rsync command
    # SSH_KEY: The private DSA key to use for SSH authentication
    # RSYNC_VHOST_SRC_PATH: Path to the source virtual host files on the remote host
    # RSYNC_VHOST_SRC_DIR: Directory of the source virtual host files on the remote host
    # RSYNC_VHOST_DST_PATH: Path to the destination on the local host
    # SED_VHOST_MOD_FILE: Location of the SED parameters to modify VHOST config files
    
    REM_HOST="web.server.com"
    RSYNC_USER="rsync"
    RSYNC_OPTS="-­­avz ­­--perms ­-q ­­--delete­during"
    SSH_KEY="/var/www/rsync_ssh_key"
    RSYNC_VHOST_SRC_PATH="/home/httpd/vhosts/"
    RSYNC_VHOST_SRC_DIR="vhost_directory"
    RSYNC_VHOST_DST_PATH="/var/www/vhosts/"
    SED_VHOST_MOD_FILE="/var/www/vhost_include.sed"
    
    rsync ­$RSYNC_OPTS \
    -­e "ssh ­-i $SSH_KEY ­-l $RSYNC_USER" \ $RSYNC_USER@$REM_HOST:$RSYNC_VHOST_SRC_PATH$RSYNC_VHOST_SRC_DIR $RSYNC_VHOST_DST_PATH
    rsync ­$RSYNC_OPTS ­­--include "*/" ­­--include "*.include" ­­--exclude "*" \
    -­e "ssh ­-i $SSH_KEY ­-l $RSYNC_USER" \
    $RSYNC_USER@$REM_HOST:$RSYNC_VHOST_SRC_PATH$RSYNC_VHOST_SRC_DIR $RSYNC_VHOST_DST_PATH
    
    for file in $RSYNC_VHOST_DST_PATH$RSYNC_VHOST_SRC_DIR/conf/httpd.include ; do
    sed ­-f $SED_VHOST_MOD_FILE "$file" > tmp_file
    mv tmp_file "$file"
    echo "Modified $file"
    done
    
    chmod ug+rwx ­R $RSYNC_VHOST_DST_PATH$RSYNC_VHOST_SRC_DIR
    
    apache2ctl graceful
    

    copy | embed

    0 comments - tagged in  posted by bhubbard on Mar 17, 2009 at 10:06 a.m. EDT
  • Plesk Upgrade Script
    #!/usr/bin/perl
    
    # http://www.transcendlinux.com/plesk-upgrade-script
    # pleskpreinstall.pl
    # version 0.40 (6-20-06)
    # Written by: Jonathan Kelly
    # -
    # Determines current redhat and plesk versions and downloads the necessary files for the upgrade from sw-soft
    # blows up tomcat entries in the database (YAY!)
    
    
    # get the plesk and redhat versions
    $versionstring = `cat /usr/local/psa/version`;
    ($pleskversionstring, $crap, $rhversion, $pleskbuild) = split( / /, $versionstring );
    ($pleskmajor, $pleskminor, $plesksub) = split( /\./, $pleskversionstring );
    $pleskversion = $pleskmajor . "." . $pleskminor;
    $pleskstring = $pleskversion . $rhversion;
    
    # these are the paths to the tarballs for the various versions
    $pleskpath{ '7.0el2.1' } = 'ftp://anonymous:anonymous@download1.sw-soft.com/Plesk/Plesk7/RedHatEL2.1/psa-7.0.4-rhel2.1.build040723.13.i586.rpm.tar.gz';
    $pleskpath{ '7.0el3' } = 'ftp://anonymous:anonymous@download1.sw-soft.com/Plesk/Plesk7/RedHatEL3/psa-7.0.4-rhel3.build040723.13.i586.rpm.tar.gz';
    $pleskpath{ '7.1el2.1' } = 'ftp://anonymous:anonymous@download1.sw-soft.com/Plesk/Plesk7.1/RHEL2.1/psa-7.1.7-rhel2.1.build71050228.12.i586.rpm.tar.gz';
    $pleskpath{ '7.1el3' } = 'ftp://anonymous:anonymous@download1.sw-soft.com/Plesk/Plesk7.1/RHEL3.0/psa-7.1.7-rhel3.build71050228.12.i586.rpm.tar.gz';
    $pleskpath{ '7.5el2.1' } = 'ftp://anonymous:anonymous@download1.sw-soft.com/Plesk/Plesk7.5/RedHatEL2.1/psa-7.5.4-rhel2.1.build75060618.14.i586.rpm.tar.gz';
    $pleskpath{ '7.5el3' } = 'ftp://anonymous:anonymous@download1.sw-soft.com/Plesk/Plesk7.5/RedHatEL3.0/psa-7.5.4-rhel3.build75060617.18.i586.rpm.tar.gz';
    $pleskpath{ '7.5el4' } = 'ftp://anonymous:anonymous@download1.sw-soft.com/Plesk/Plesk7.5/RedHatEL4.0/psa-7.5.4-rhel4.build75060617.18.i586.rpm.tar.gz';
    
    
    # make the appropriate directories and download the appropriate tarballs
    system( "mkdir /home/rack/pleskupgrade" ) unless ( -e "/home/rack/pleskupgrade" );
    if ( $pleskmajor eq "6" ) {
        system( "mkdir /home/rack/pleskupgrade/7.0.4/" ) unless ( -e "/home/rack/pleskupgrade/7.0.4/" );
        chdir( "/home/rack/pleskupgrade/7.0.4/" );
        $getthisnow = "7.0" . $rhversion;
        system( "wget $pleskpath{ $getthisnow }" );
        system( "tar -zxvf *.gz" );
        system( "rm -f *.gz" );
    }
    if ( $pleskversion eq "7.0" || $pleskmajor eq "6" ) {
        system( "mkdir /home/rack/pleskupgrade/7.1.7/" ) unless ( -e "mkdir /home/rack/pleskupgrade/7.1.7/" );
        chdir( "/home/rack/pleskupgrade/7.1.7/" );
        $getthisnow = "7.1" . $rhversion;
        system( "wget $pleskpath{ $getthisnow }" );
        system( "tar -zxvf *.gz" );
        system( "rm -f *.gz" );
    }
    if ( $pleskversion eq "7.5" || $pleskversion eq "7.1" || $pleskversion eq "7.0" || $pleskmajor eq "6") {
        if ( $pleskversion eq "7.5" && $plesksub eq "4" && $pleskbuild eq "060118.19") {
            die "Plesk install appears to be up to date! Current version: $pleskversionstring\n" ;
        } else {
            system( "mkdir /home/rack/pleskupgrade/7.5.4/" ) unless ( -e "mkdir /home/rack/pleskupgrade/7.5.4/" );
            chdir( "/home/rack/pleskupgrade/7.5.4/" );
            $getthisnow = "7.5" . $rhversion;
            system( "wget $pleskpath{ $getthisnow }" );
            system( "tar -zxvf *.gz" );
            system( "rm -f *.gz" );
        }
    } else { die "z0mg unsupported plesk version $pleskversion!!!!!!!!!!!!\n"; }
    
    # back that sql database up
    chdir( "/home/rack/pleskupgrade/" );
    system( "mysqldump --opt -Q -A -uadmin -p`cat /etc/psa/.psa.shadow` >mysqlbak$pleskversion" );
    # back up other stuff
    system( "cp -auf /etc/my.cnf ." );
    system( "cp -auf /etc/psa/psa.key ." );
    system( "cp -auf /etc/rc.d/init.d/mysql* ." );
    system( "cp -auf /etc/php.ini ." );
    system( "cp -auf /etc/httpd/conf/httpd.conf ." );
    system( "cp -auf /etc/httpd/conf.d/ssl.conf ." );
    # blow up any tomcat entries to save us from the evil dual tomcat error
    system( "mysql -u admin -p`cat /etc/psa/.psa.shadow` psa -e \"delete from Components where name like \'\%tomcat\%\'\"" );
    
    # make sure the mysqld symlink is there
    system( "ln -s /etc/init.d/mysql /etc/init.d/mysqld" ) unless ( -e "/etc/init.d/mysqld" );
    
    print( "Plesk Version: $pleskversionstring\n" );
    print( "Redhat Version: $rhversion\n" );
    

    copy | embed

    0 comments - tagged in  posted by bhubbard on Mar 17, 2009 at 10:05 a.m. EDT
  • Plesk - Reverse DNS lookup for all domains
    #!/bin/bash
    # This will do a reverse DNS lookup for you domains in Plesk
    for i in `ls /home/httpd/vhosts/ |grep "\."`
    do
    host=$i
    ip=`host $i|awk {'print $4'}`
    if [ $ip == "found:" ]; then
       echo "$host DOES NOT RESOLVE"
       continue
    fi
    ptr=`host -t PTR $ip|awk {'print $5'}`
    if [ $ptr == "3(NXDOMAIN)" ]; then
       echo "$ip ($host) HAS NO PTR"
    else
       echo "$ip ($host) has PTR $ptr"
    fi
    done
    

    copy | embed

    0 comments - tagged in  posted by bhubbard on Mar 17, 2009 at 10:03 a.m. EDT
  • Restart Plesk Spamassassin
    /etc/init.d/psa-spamassassin restart
    

    copy | embed

    0 comments - tagged in  posted by bhubbard on Feb 18, 2009 at 11:38 a.m. EST
  • Stop Plesk Spamassassin
    /etc/init.d/psa-spamassassin stop
    

    copy | embed

    0 comments - tagged in  posted by bhubbard on Feb 18, 2009 at 11:37 a.m. EST
Sign up to create your own snipts, or login.