# HG changeset patch # User Jeff Hammel # Date 1428953624 25200 # Node ID d638b8578c785b0ddf0e9339c4385cd728a0afbf # Parent 8a6ee9df8ae52f78c82df5d82d09a001c657855f as a service diff -r 8a6ee9df8ae5 -r d638b8578c78 supervisoradmin/add.py --- 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()