瀏覽代碼

Limit the maximum amount of pastebin content

Bob Mottram 11 年之前
父節點
當前提交
432484551e
共有 1 個文件被更改,包括 38 次插入1 次删除
  1. 38
    1
      beaglebone.txt

+ 38
- 1
beaglebone.txt 查看文件

6607
 git clone https://github.com/sametmax/0bin.git
6607
 git clone https://github.com/sametmax/0bin.git
6608
 cd 0bin
6608
 cd 0bin
6609
 python setup.py install
6609
 python setup.py install
6610
+chown -R zerobin:zerobin /usr/local/lib/python2.7/dist-packages/zerobin-0.4.1-py2.7.egg/zerobin/static
6610
 #+END_SRC
6611
 #+END_SRC
6611
 
6612
 
6613
+For the /chown/ command you may need to change the directory name within /dist-packages/, depending upon the version number of [[https://github.com/sametmax/0bin][0bin]].
6614
+
6612
 Now create the daemon.
6615
 Now create the daemon.
6613
 
6616
 
6614
 #+BEGIN_SRC: bash
6617
 #+BEGIN_SRC: bash
6718
 service apache2 restart
6721
 service apache2 restart
6719
 #+END_SRC
6722
 #+END_SRC
6720
 
6723
 
6721
-You can now visit your new site and paste things for others to see, and vice versa.  Uploads are limited to 256K in size to prevent your storage space from being used up.
6724
+You can now visit your new site and paste things for others to see, and vice versa.  Uploads are limited to 256K in size to prevent your storage space from being used up.  You can further limit the maximum amount of storage space by doing the following:
6725
+
6726
+#+BEGIN_SRC: bash
6727
+editor /usr/bin/zerobinupdate
6728
+#+END_SRC
6729
+
6730
+Add the following:
6731
+
6732
+#+BEGIN_SRC: bash
6733
+#!/bin/bash
6734
+
6735
+CONTENT=/usr/local/lib/python2.7/dist-packages/zerobin-0.4.1-py2.7.egg/zerobin/static/content
6736
+
6737
+# Exit if there is no content directory
6738
+if [[ ! -d $CONTENT ]]; then
6739
+	exit
6740
+fi
6741
+
6742
+LOG=/home/zerobin/zerobin.log
6743
+CHECK=`du -hs $CONTENT`
6744
+regex="([0-9]+)G"
6745
+
6746
+if [[ $CHECK =~ $regex && ${BASH_REMATCH[1]} -gt 1 ]]; then
6747
+    echo "Directory size limit exceeded - removing zerobin content" >> $LOG
6748
+    rm -rf $CONTENT/*
6749
+fi
6750
+#+END_SRC
6751
+
6752
+Save and exit.
6753
+
6754
+#+BEGIN_SRC: bash
6755
+chmod +x /usr/bin/zerobinupdate
6756
+echo "*/5            * *   *   *   root /usr/bin/timeout 120 /usr/bin/zerobinupdate" >> /etc/crontab
6757
+service cron restart
6758
+#+END_SRC
6722
 
6759
 
6723
 ** Install Tripwire
6760
 ** Install Tripwire
6724
 
6761