Skip to content

Commit

Permalink
opts
Browse files Browse the repository at this point in the history
  • Loading branch information
nir0s committed Dec 20, 2015
1 parent d4337a7 commit ec9971f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ pip install https://github.com/nir0s/serv/archive/master.tar.gz
### Creating a daemon

```shell
sudo serv create --name MySimpleHTTPServer --cmd /usr/bin/python2 --args '-m SimpleHTTPServer' --var KEY1=VALUE1 --var KEY2=VALUE2 --start -v
sudo serv create /usr/bin/python2 --name MySimpleHTTPServer --args '-m SimpleHTTPServer' --var KEY1=VALUE1 --var KEY2=VALUE2 --start -v
```

### Removing a daemon

```shell
sudo serv remove --name MySimpleHTTPServer
sudo serv remove MySimpleHTTPServer
```

### Retrieving a daemon's status

```shell
sudo serv status --name MySimpleHTTPServer
sudo serv status MySimpleHTTPServer
```

or for all services
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
For information on this package please refer to http://github.com/nir0s/ld
For information on this package please refer to http://github.com/nir0s/serv
6 changes: 0 additions & 6 deletions serv/init/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ def __init__(self, lgr=None, **params):
self.init_sys_ver = params.get('init_sys_ver')
self.cmd = params.get('cmd')
self.name = params.get('name')
self.args = params.get('args', '')
self.description = params.get('description', 'no description given')
self.user = params.get('user', 'root')
self.group = params.get('group', 'root')
self.chdir = params.get('chdir', '/')
self.chroot = params.get('chroot', '/')

# only relevant when retrieving status.
self.services = dict(
Expand Down
27 changes: 17 additions & 10 deletions serv/serv.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,10 @@ def main():


@click.command()
@click.option('-c', '--cmd', required=True,
help='Absolute or in $PATH command to run.')
@click.argument('cmd', required=True)
@click.option('-n', '--name',
help='Name of service to create. If omitted, will be deducated '
'from the name of the executable.')
@click.option('--init-system', required=False,
type=click.Choice(Serv().implementations),
help='Init system to use.')
Expand All @@ -286,18 +288,25 @@ def main():
@click.option('-s', '--start', default=False, is_flag=True,
help='Start the service after creating it.')
@click.option('-v', '--verbose', default=False, is_flag=True)
def create(cmd, init_system, init_system_version, args, var, overwrite, start,
verbose):
# TODO: should probably pass **params here instead and pass them directly to
# Serv().create() as we have system specific parameters which will be passed
# here.
def create(cmd, name, init_system, init_system_version, args, var, overwrite,
start, verbose):
"""Creates (and maybe runs) a service.
"""
logger.configure()
Serv(init_system, init_system_version, verbose).create(
cmd=cmd, args=args, env=var, overwrite=overwrite, start=start)
cmd=cmd,
name=name,
args=args,
env=var,
overwrite=overwrite,
start=start)


@click.command()
@click.option('-n', '--name',
help='Name of service to remove.')
@click.argument('name')
@click.option('--init-system', required=False,
type=click.Choice(Serv().implementations),
help='Init system to use.')
Expand All @@ -310,9 +319,7 @@ def remove(name, init_system, verbose):


@click.command()
@click.option('-n', '--name', required=False,
help='Name of service to get status for. If omitted, will '
'returns the status for all services.')
@click.argument('name', required=False)
@click.option('--init-system', required=False,
type=click.Choice(Serv().implementations),
help='Init system to use.')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def read(*parts):

setup(
name='Serv',
version="0.0.2",
version="0.0.3",
url='https://github.com/nir0s/serv',
author='nir0s',
author_email='nir36g@gmail.com',
Expand Down

0 comments on commit ec9971f

Please sign in to comment.