Mercurial > hg > SupervisorAdmin
diff supervisoradmin/add.py @ 5:d638b8578c78
as a service
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Mon, 13 Apr 2015 12:33:44 -0700 |
parents | 8a6ee9df8ae5 |
children | a1e06f4a8076 |
line wrap: on
line diff
--- a/supervisoradmin/add.py Mon Apr 13 12:04:00 2015 -0700 +++ b/supervisoradmin/add.py Mon Apr 13 12:33:44 2015 -0700 @@ -74,11 +74,16 @@ name = options.name or basename(command[0]) # output configuration file - output = options.output or os.path.join(SUPERVISOR_CONF, '{}.conf'.format(name)) + output = options.output or open(os.path.join(SUPERVISOR_CONF, '{}.conf'.format(name)), 'w') - print (template.format(name=name, - user=options.user, - command=options.command)) + output.write(template.format(name=name, + user=options.user, + command=options.command)) + output.close() + + if options.output is None: + # update the supervisor state + subprocess.check_call(['sudo', 'supervisorctl', 'update']) if __name__ == '__main__': main()