snipt

Ctrl+h for KB shortcuts

Bash

test mod_gzip and mod_deflate

curl http://example.com -H "Accept-Encoding: gzip,deflate"
https://snipt.net/embed/cd30f40276a632b9daa4c2a5e20db3ef/
/raw/cd30f40276a632b9daa4c2a5e20db3ef/
cd30f40276a632b9daa4c2a5e20db3ef
bash
Bash
1
2019-06-19T08:22:34
True
False
False
Jan 16, 2014 at 08:41 PM
/api/public/snipt/106445/
test-mod_gzip-and-mod_deflate
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>curl http://example.com -H <span class="s2">&quot;Accept-Encoding: gzip,deflate&quot;</span> </span></pre></div> </td></tr></table>
mod-gzip, mod_deflate

Bash

rsync without overwriting existing files

rsync -av —ignore-existing source/ destination/
https://snipt.net/embed/d77ffa932d4d210a16a7b99eb41a412f/
/raw/d77ffa932d4d210a16a7b99eb41a412f/
d77ffa932d4d210a16a7b99eb41a412f
bash
Bash
1
2019-06-17T11:14:16
True
False
False
Oct 04, 2013 at 08:39 PM
/api/public/snipt/85706/
rsync-without-overwriting-existing-files
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>rsync -av —ignore-existing source/ destination/ </span></pre></div> </td></tr></table>
rsync

Bash

Total messages for plesk email

find /var/qmail/mailnames/EXAMPLE.COM/USERNAME/Maildir/ -type f -print | wc -l
https://snipt.net/embed/0ded253230208f3896197fedb0a42453/
/raw/0ded253230208f3896197fedb0a42453/
0ded253230208f3896197fedb0a42453
bash
Bash
1
2019-06-16T09:05:38
True
False
False
Jun 27, 2013 at 08:03 PM
/api/public/snipt/65909/
total-messages-for-plesk-email
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>find /var/qmail/mailnames/EXAMPLE.COM/USERNAME/Maildir/ -type f -print <span class="p">|</span> wc -l </span></pre></div> </td></tr></table>
email, plesk

Bash

Install Yum

rpm -Uvh http://mirror.centos.org/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
https://snipt.net/embed/122987a72579dbf221c2e6d98e1350ca/
/raw/122987a72579dbf221c2e6d98e1350ca/
122987a72579dbf221c2e6d98e1350ca
bash
Bash
1
2019-06-17T08:38:34
True
False
False
/api/public/snipt/57302/
install-yum
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>rpm -Uvh http://mirror.centos.org/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm </span></pre></div> </td></tr></table>
install, yum

Bash

Block all SSH Access except one IP

1
2
3
4
5
#create access for specific IP:
iptables -A INPUT -m state --state NEW,ESTABLISHED,RELATED --source x.x.x.x -p tcp --dport 22 -j ACCEPT

#block all others
iptables -A INPUT -m state --state NEW,ESTABLISHED,RELATED -p tcp --dport 22 -j DROP
https://snipt.net/embed/6d66619c16e7b97c1c7506a381a6bce0/
/raw/6d66619c16e7b97c1c7506a381a6bce0/
6d66619c16e7b97c1c7506a381a6bce0
bash
Bash
5
2019-06-10T15:06:03
True
False
False
Feb 27, 2013 at 01:35 PM
/api/public/snipt/56620/
block-all-ssh-access-except-one-ip
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">#create access for specific IP:</span> </span><span id="L-2"><a name="L-2"></a>iptables -A INPUT -m state --state NEW,ESTABLISHED,RELATED --source x.x.x.x -p tcp --dport <span class="m">22</span> -j ACCEPT </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1">#block all others</span> </span><span id="L-5"><a name="L-5"></a>iptables -A INPUT -m state --state NEW,ESTABLISHED,RELATED -p tcp --dport <span class="m">22</span> -j DROP </span></pre></div> </td></tr></table>
iptables

Bash

rsync

rsync -av /where you want it from/ /where you want it too/
https://snipt.net/embed/89c3491da0f5c3abe74f676deec7b8ab/
/raw/89c3491da0f5c3abe74f676deec7b8ab/
89c3491da0f5c3abe74f676deec7b8ab
bash
Bash
1
2019-06-18T07:16:48
True
False
False
Feb 13, 2013 at 08:34 PM
/api/public/snipt/55725/
rsync-7
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>rsync -av /where you want it from/ /where you want it too/ </span></pre></div> </td></tr></table>
rsync

Bash

Fix Paths in Database

1
2
3
4
mysqldump --add-drop-table -u Username -p dbname > dbname.sql
cp -v dump.sql dump.backup.sql
perl -p -i -e "s~/OLD/PATH~/NEW/PATH~g" dump.sql
mysql -uadmin -p`cat /etc/psa/.psa.shadow` dbname < dump.sql
https://snipt.net/embed/d29eddcc7cc68382df7cba96c02195db/
/raw/d29eddcc7cc68382df7cba96c02195db/
d29eddcc7cc68382df7cba96c02195db
bash
Bash
4
2019-06-05T07:04:37
True
False
False
/api/public/snipt/55705/
fix-paths-in-database
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>mysqldump --add-drop-table -u Username -p dbname &gt; dbname.sql </span><span id="L-2"><a name="L-2"></a>cp -v dump.sql dump.backup.sql </span><span id="L-3"><a name="L-3"></a>perl -p -i -e <span class="s2">&quot;s~/OLD/PATH~/NEW/PATH~g&quot;</span> dump.sql </span><span id="L-4"><a name="L-4"></a>mysql -uadmin -p<span class="sb">`</span>cat /etc/psa/.psa.shadow<span class="sb">`</span> dbname &lt; dump.sql </span></pre></div> </td></tr></table>
FixPath, database

Bash

Plesk Command Line Utilities

1
2
3
4
5
http://download1.parallels.com/Plesk/PP11/11.0/Doc/en-US/online/plesk-unix-cli/

./usr/local/psa/bin/mail --update-service <domain.com> -status disabled

./subscription -u example.com -mail_service false
https://snipt.net/embed/382b3b927e1fe82884d4926637dfbe5f/
/raw/382b3b927e1fe82884d4926637dfbe5f/
382b3b927e1fe82884d4926637dfbe5f
bash
Bash
5
2019-06-11T00:52:12
True
False
False
Jan 07, 2013 at 04:56 PM
/api/public/snipt/52885/
plesk-command-line-utilities
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>http://download1.parallels.com/Plesk/PP11/11.0/Doc/en-US/online/plesk-unix-cli/ </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>./usr/local/psa/bin/mail --update-service &lt;domain.com&gt; -status disabled </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>./subscription -u example.com -mail_service <span class="nb">false</span> </span></pre></div> </td></tr></table>
Plesk, PleskCommandLine

Bash

Unsuspend Domain in Plesk - SSH

/usr/local/psa/bin/domain -u mydomain.com -status enabled
https://snipt.net/embed/96756b37bc7bf006c1d8977247f7d4e6/
/raw/96756b37bc7bf006c1d8977247f7d4e6/
96756b37bc7bf006c1d8977247f7d4e6
bash
Bash
1
2019-06-19T10:16:41
True
False
False
Dec 26, 2012 at 07:47 PM
/api/public/snipt/52384/
unsuspend-domain-in-plesk-ssh
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>/usr/local/psa/bin/domain -u mydomain.com -status enabled </span></pre></div> </td></tr></table>
"enable domain", plesk