casd | 50 --------------------------------------------------
1 file changed, 50 deletions(-)
New commits:
commit 9e5d06de1a2c2e76faa3646251b74747ca3dc0b6
Author: adam stokes <uzr(a)jak.rebo>
Date: Thu Jul 23 10:17:06 2009 -0400
- stupid to use a daemon
diff --git a/casd b/casd
deleted file mode 100755
index 65f62e0..0000000
--- a/casd
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <
http://www.gnu.org/licenses/>.
-
-# casd - daemon watcher for various items.
-
-import os
-import sys
-
-class Daemonize(object):
- """ daemonize class """
-
- def startDaemon(self):
- """ start daemon method """
-
- try:
- pid = os.fork()
- except OSError, e:
- raise SystemExit("Unable to fork %s" % (e.strerror,))
-
- import resource
- maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
- if (maxfd == resource.RLIM_INFINITY):
- maxfd = MAXFD
-
- # close file descriptors
- for i in range(0, self.maxfd):
- try:
- os.close(i)
- except OSError:
- pass
-
- os.open(os.devnull, os.R_RDWR)
- os.dup2(0,1) # dup stdin to
- os.dup2(0,2) # stdout, stderr
-
- def __init__(self):
- self.workdir = "/"
- self.maxfd = 1024
- self.umask = 0