mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-11-16 16:54:51 +02:00
Merge branch 'master' into unstable
This commit is contained in:
commit
2e39265da1
26
README.rst
26
README.rst
@ -26,6 +26,12 @@ unstable
|
||||
********
|
||||
*Never* use this branch for production. Major new features pull requests goes here.
|
||||
|
||||
Linux
|
||||
-----
|
||||
|
||||
GNS3 is perhaps packaged for your distribution:
|
||||
* Gentoo: https://packages.gentoo.org/package/net-misc/gns3-server
|
||||
|
||||
|
||||
Linux (Debian based)
|
||||
--------------------
|
||||
@ -62,6 +68,26 @@ To run tests use:
|
||||
|
||||
py.test -v
|
||||
|
||||
|
||||
Run as daemon
|
||||
***************
|
||||
|
||||
You will found init sample script for various systems
|
||||
inside the init directory.
|
||||
|
||||
upstart
|
||||
~~~~~~~
|
||||
|
||||
For ubuntu < 15.04
|
||||
|
||||
You need to copy init/gns3.conf.upstart to /etc/init/gns3.conf
|
||||
|
||||
.. code:: bash
|
||||
|
||||
sudo chown root /etc/init/gns3.conf
|
||||
sudo service gns3 start
|
||||
|
||||
|
||||
Windows
|
||||
-------
|
||||
|
||||
|
@ -92,6 +92,7 @@ def parse_arguments(argv, config):
|
||||
"quiet": config.getboolean("quiet", False),
|
||||
"debug": config.getboolean("debug", False),
|
||||
"live": config.getboolean("live", False),
|
||||
"logfile": config.getboolean("logfile", ""),
|
||||
}
|
||||
|
||||
parser = argparse.ArgumentParser(description="GNS3 server version {}".format(__version__))
|
||||
@ -109,6 +110,7 @@ def parse_arguments(argv, config):
|
||||
parser.add_argument("-d", "--debug", action="store_true", help="show debug logs")
|
||||
parser.add_argument("--live", action="store_true", help="enable code live reload")
|
||||
parser.add_argument("--shell", action="store_true", help="start a shell inside the server (debugging purpose only you need to install ptpython before)")
|
||||
parser.add_argument("--log", help="send output to logfile instead of console")
|
||||
|
||||
return parser.parse_args(argv)
|
||||
|
||||
@ -141,7 +143,7 @@ def main():
|
||||
if args.debug:
|
||||
level = logging.DEBUG
|
||||
|
||||
user_log = init_logger(level, quiet=args.quiet)
|
||||
user_log = init_logger(level, logfile=args.log, quiet=args.quiet)
|
||||
user_log.info("GNS3 server version {}".format(__version__))
|
||||
current_year = datetime.date.today().year
|
||||
user_log.info("Copyright (c) 2007-{} GNS3 Technologies Inc.".format(current_year))
|
||||
|
@ -78,8 +78,11 @@ class ColouredStreamHandler(logging.StreamHandler):
|
||||
self.handleError(record)
|
||||
|
||||
|
||||
def init_logger(level, quiet=False):
|
||||
if sys.platform.startswith("win"):
|
||||
def init_logger(level, logfile=None, quiet=False):
|
||||
if logfile and len(logfile) > 0:
|
||||
stream_handler = logging.FileHandler(logfile)
|
||||
stream_handler.formatter = ColouredFormatter("{asctime} {levelname} {filename}:{lineno} {message}", "%Y-%m-%d %H:%M:%S", "{")
|
||||
elif sys.platform.startswith("win"):
|
||||
stream_handler = logging.StreamHandler(sys.stdout)
|
||||
stream_handler.formatter = ColouredFormatter("{asctime} {levelname} {filename}:{lineno} {message}", "%Y-%m-%d %H:%M:%S", "{")
|
||||
else:
|
||||
|
19
init/gns3.conf.upstart
Normal file
19
init/gns3.conf.upstart
Normal file
@ -0,0 +1,19 @@
|
||||
description "GNS3 server"
|
||||
author "GNS3 Team"
|
||||
|
||||
start on filesystem or runlevel [2345]
|
||||
stop on shutdown
|
||||
|
||||
script
|
||||
echo $$ > /var/run/gns3.pid
|
||||
exec start-stop-daemon --start -c gns3 --exec /usr/local/bin/gns3server --log /var/log/gns3.log
|
||||
end script
|
||||
|
||||
pre-start script
|
||||
echo "[`date`] GNS3 Starting" >> /var/log/gns3.log
|
||||
end script
|
||||
|
||||
pre-stop script
|
||||
rm /var/run/gns3.pid
|
||||
echo "[`date`] GNS3 Stopping" >> /var/log/gns3.log
|
||||
end script
|
Loading…
Reference in New Issue
Block a user