Newsyslog with SIGHUP

WebWare don't manage it's logs. it print log in stdin. so I run AppServer like:

$ APPSERVER/AppServer >> Logs/webware.log 2>&1 command.

But this method cause to large log file. so I fix problem with newsyslog and some fix on Launch.py

In your application's Launch.py add below lines:

import signal

def setupSignal():
    def handlerHUP(signum, frame):
        sys.exit(3)

    signal.signal( signal.SIGHUP, handlerHUP)

and edit main():

def main(args):
    global webwarePath, appWorkPath

    setupSignal()

    bla bla ...

edit /etc/newsyslog.conf:

/$APPSERVER/Logs/webware.log     webware:webware 644  5  1000  *       Z       /$APPSERVER/appserverpid.txt

then run newsyslog. you will see:

$ ls -l /$APPSERVER/Logs/webware.log*
-rw-r--r--  1 webware  webware      75  4 25 10:59 /$APPSERVER/Logs/webware.log
-rw-r--r--  1 webware  webware  187907  4 25 10:59 /$APPSERVER/Logs/webware.log.0.gz