aboutsummaryrefslogtreecommitdiff
path: root/debian/tor.init
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2008-02-20 22:28:09 +0000
committerPeter Palfrader <peter@palfrader.org>2008-02-20 22:28:09 +0000
commit644452a62fde5fec66dab56c4f47204f42b57bac (patch)
treeedd45cffb77bd2bf1396303852826e8fab1bacac /debian/tor.init
parent384a8ab777999c984509ad57d9d8ae859a0ed5c9 (diff)
downloadtor-644452a62fde5fec66dab56c4f47204f42b57bac.tar
tor-644452a62fde5fec66dab56c4f47204f42b57bac.tar.gz
Change the default for MAX_FILEDESCRIPTORS in our init script to depend on the
number of system-wide available file descriptors: /proc/sys/fs/file-max is bigger than 100k, set ulimit -n to 32k, if it's smaller than 20k set it to 1024. Big servers at the moment regularly use more than 10k FDs, so our old default of 8k no longer is sufficient. On the other hand we don't want lower end systems to run out of FDs on Tor's account. svn:r13625
Diffstat (limited to 'debian/tor.init')
-rw-r--r--debian/tor.init15
1 files changed, 14 insertions, 1 deletions
diff --git a/debian/tor.init b/debian/tor.init
index ec5707d7d..415467e87 100644
--- a/debian/tor.init
+++ b/debian/tor.init
@@ -25,7 +25,20 @@ TORPID=$TORPIDDIR/tor.pid
DEFAULTSFILE=/etc/default/$NAME
WAITFORDAEMON=60
ARGS=""
-MAX_FILEDESCRIPTORS=8192
+# Let's try to figure our some sane defaults:
+if [ -r /proc/sys/fs/file-max ]; then
+ system_max=`cat /proc/sys/fs/file-max`
+ if [ "$system_max" -gt "100000" ] ; then
+ MAX_FILEDESCRIPTORS=32768
+ elif [ "$system_max" -gt "20000" ] ; then
+ MAX_FILEDESCRIPTORS=8192
+ else
+ MAX_FILEDESCRIPTORS=1024
+ fi
+else
+ MAX_FILEDESCRIPTORS=8192
+fi
+
NICE=""
test -x $DAEMON || exit 0