Permalink
Browse files

add logging and friendlier messages

svn path=/collective.transcode.recipe/trunk/; revision=121622
  • Loading branch information...
1 parent e8d06fa commit 9ed248dceae270d0bf6fee98948b78e284b8944a @d-mo d-mo committed Jul 22, 2010
Showing with 12 additions and 4 deletions.
  1. +12 −4 collective/transcode/recipe/ctl.py
@@ -9,6 +9,7 @@
from os.path import dirname, join
from collective.transcode import daemon
from twisted.scripts.twistd import run
+from twisted.python import log
cmd_map = dict(
fg=('-n',),
@@ -17,16 +18,23 @@
def main(args):
if args[1] == 'stop':
- pid = int(file('%s/TranscodeDaemon.pid' % args[0]).read())
- os.kill(pid, 15)
+ try:
+ pid = int(file('%s/transcodedaemon.pid' % args[0]).read())
+ os.kill(pid, 15)
+ print "TranscodeDaemon stopped"
+ except:
+ print "TranscodeDaemon not running"
return
os.environ['TRANSCODEDAEMON_ROOT'] = args[0]
py_file = join(dirname(daemon.__file__), 'transcodedaemon.py')
if '--pidfile' in args:
pidfile = args[args.index('--pidfile')+1]
else:
- pidfile = '%s/TranscodeDaemon.pid' % args[0]
- options = ['-y', py_file, '--pidfile', pidfile]
+ pidfile = '%s/transcodedaemon.pid' % args[0]
+ logfile = '%s/transcodedaemon.log' % args[0]
+ options = ['-y', py_file, '--pidfile', pidfile, '--logfile', logfile]
+
+
options.extend(cmd_map[args[1]])
sys.argv[1:]=[]
sys.argv.extend(options)

0 comments on commit 9ed248d

Please sign in to comment.