Mercurial > hg > SupervisorAdmin
comparison 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 |
comparison
equal
deleted
inserted
replaced
4:8a6ee9df8ae5 | 5:d638b8578c78 |
---|---|
72 | 72 |
73 # name | 73 # name |
74 name = options.name or basename(command[0]) | 74 name = options.name or basename(command[0]) |
75 | 75 |
76 # output configuration file | 76 # output configuration file |
77 output = options.output or os.path.join(SUPERVISOR_CONF, '{}.conf'.format(name)) | 77 output = options.output or open(os.path.join(SUPERVISOR_CONF, '{}.conf'.format(name)), 'w') |
78 | 78 |
79 print (template.format(name=name, | 79 output.write(template.format(name=name, |
80 user=options.user, | 80 user=options.user, |
81 command=options.command)) | 81 command=options.command)) |
82 output.close() | |
83 | |
84 if options.output is None: | |
85 # update the supervisor state | |
86 subprocess.check_call(['sudo', 'supervisorctl', 'update']) | |
82 | 87 |
83 if __name__ == '__main__': | 88 if __name__ == '__main__': |
84 main() | 89 main() |