Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Bash

Check apache memory consumption

ps aux | egrep ^apache | awk 'BEGIN {x=0} {x+=$4} END {print x}'
https://snipt.net/embed/d2fdfbf1c930bae5963a7d27081d0c8e/
https://snipt.net/raw/d2fdfbf1c930bae5963a7d27081d0c8e/
d2fdfbf1c930bae5963a7d27081d0c8e
bash
Bash
1
2016-12-10T00:00:28
True
False
False
/api/public/snipt/14568/
check-apache-memory-consumption
<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>ps aux <span class="p">|</span> egrep ^apache <span class="p">|</span> awk <span class="s1">&#39;BEGIN {x=0} {x+=$4} END {print x}&#39;</span> </span></pre></div> </td></tr></table>
apache, awk, dv, egrep, memory, ps

Bash

Search Access Logs

grep -h "?*=http://" ../../logs/access_log*| awk '$9 !~/^4/ && $7 ~/\?*\=http\:\/\// && /Feb/'|egrep -v '\/(.+)\/.*\?.*\=http\:\/\/\1' > ac.txt
https://snipt.net/embed/b8a4c1d7a2df69f6e5833db9cc1aa7d6/
https://snipt.net/raw/b8a4c1d7a2df69f6e5833db9cc1aa7d6/
b8a4c1d7a2df69f6e5833db9cc1aa7d6
bash
Bash
1
2016-12-02T14:22:23
True
False
False
/api/public/snipt/13557/
search-access-logs
<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>grep -h <span class="s2">&quot;?*=http://&quot;</span> ../../logs/access_log*<span class="p">|</span> awk <span class="s1">&#39;$9 !~/^4/ &amp;&amp; $7 ~/\?*\=http\:\/\// &amp;&amp; /Feb/&#39;</span><span class="p">|</span>egrep -v <span class="s1">&#39;\/(.+)\/.*\?.*\=http\:\/\/\1&#39;</span> &gt; ac.txt </span></pre></div> </td></tr></table>
dv, gs, hacked, site

Bash

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
https://snipt.net/embed/daad6706ddd9b9d71228f2dffe545612/
https://snipt.net/raw/daad6706ddd9b9d71228f2dffe545612/
daad6706ddd9b9d71228f2dffe545612
bash
Bash
1
2016-12-07T11:37:45
True
False
False
/api/public/snipt/13515/
ssl-cert-showing-self-signed-fix
<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>cp /etc/httpd/conf.d/ssl.conf /etc/httpd/conf.d/ssl.conf.old <span class="o">&amp;&amp;</span> vi +/VirtualHost +<span class="se">\:\.\,\$\ </span>s<span class="se">\/\^\/\#\/</span>g +<span class="se">\:</span>x /etc/httpd/conf.d/ssl.conf <span class="o">&amp;&amp;</span> service httpd restart </span></pre></div> </td></tr></table>
dv, plesk, self, signed, ssl

Text only

List allocated ram on (dv) Dedicated-Virtual Server

cat /proc/user_beancounters  | grep 'vmguarpages' | awk '{print $4*4/1024}'
https://snipt.net/embed/ae4e1d726227e9f49477650ff89b989d/
https://snipt.net/raw/ae4e1d726227e9f49477650ff89b989d/
ae4e1d726227e9f49477650ff89b989d
text
Text only
1
2016-11-18T09:58:31
True
False
False
/api/public/snipt/11048/
list-allocated-ram-on-dv-dedicated-virtual-server
<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>cat /proc/user_beancounters | grep &#39;vmguarpages&#39; | awk &#39;{print $4*4/1024}&#39; </span></pre></div> </td></tr></table>
dv, mb, memory, ram

Bash

Mediatemple (dv) server - Plesk & Apache restart

/usr/local/psa/admin/sbin/websrvmng -a -v
https://snipt.net/embed/64a52bf658113ac80b0e6ed360972556/
https://snipt.net/raw/64a52bf658113ac80b0e6ed360972556/
64a52bf658113ac80b0e6ed360972556
bash
Bash
1
2016-12-10T08:04:31
True
False
False
/api/public/snipt/9993/
restart-mediatemple-dv-pleskapache
<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/admin/sbin/websrvmng -a -v </span></pre></div> </td></tr></table>
apache, dv, mediatemple, plesk, restart

Bash

migrating email on a dv

cp /old/var/qmail/mailnames/domain.com/emailnameshere/Maildir/cur/* /var/qmail/mailnames/domain.com/emailnameshere/Maildir/cur/
https://snipt.net/embed/fb3870afca50ff0fff572190b5833738/
https://snipt.net/raw/fb3870afca50ff0fff572190b5833738/
fb3870afca50ff0fff572190b5833738
bash
Bash
1
2016-12-09T20:55:12
True
False
False
/api/public/snipt/8541/
migrating-email-on-a-dv
<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>cp /old/var/qmail/mailnames/domain.com/emailnameshere/Maildir/cur/* /var/qmail/mailnames/domain.com/emailnameshere/Maildir/cur/ </span></pre></div> </td></tr></table>
dv, email, migrate

Text only

reconfigure the web server

/usr/local/psa/admin/sbin/websrvmng -a -v
https://snipt.net/embed/6188678abb30bc80ea5c25d9a36e663e/
https://snipt.net/raw/6188678abb30bc80ea5c25d9a36e663e/
6188678abb30bc80ea5c25d9a36e663e
text
Text only
1
2016-12-09T17:48:12
True
False
False
/api/public/snipt/7398/
reconfigure-the-web-server
<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/admin/sbin/websrvmng -a -v </span></pre></div> </td></tr></table>
dv, reconfigure, server, web, webserver

Bash

fixes permissions issues with plesk/qmail

1
2
3
/usr/local/psa/admin/sbin/mchk --with-spam

/usr/local/psa/admin/bin/mailmng -o ; /usr/local/psa/admin/bin/mailmng -p ; /etc/init.d/xinetd restart ; /etc/init.d/qmail restart
https://snipt.net/embed/c4212e7a438a260bf2f5338ecee14ee4/
https://snipt.net/raw/c4212e7a438a260bf2f5338ecee14ee4/
c4212e7a438a260bf2f5338ecee14ee4
bash
Bash
4
2016-12-09T14:12:58
True
False
False
/api/public/snipt/6782/
fixes-permissions-issues-with-pleskqmail
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>/usr/local/psa/admin/sbin/mchk --with-spam </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>/usr/local/psa/admin/bin/mailmng -o <span class="p">;</span> /usr/local/psa/admin/bin/mailmng -p <span class="p">;</span> /etc/init.d/xinetd restart <span class="p">;</span> /etc/init.d/qmail restart </span></pre></div> </td></tr></table>
dv, email, mail, prmissions, spam
Copyrighted, illegal, or inappropriate content? Email [email protected].