diff --git a/rattail_fabric2/apache.py b/rattail_fabric2/apache.py index 455243c..5e1ee5b 100644 --- a/rattail_fabric2/apache.py +++ b/rattail_fabric2/apache.py @@ -146,18 +146,18 @@ def restart(c): """ Restart the Apache web service """ - c.sudo("service apache2 restart") + c.sudo('systemctl restart apache2.service') def stop(c): """ Stop the Apache web service """ - c.sudo("service apache2 stop") + c.sudo('systemctl stop apache2.service') def start(c): """ Start the Apache web service """ - c.sudo("service apache2 start") + c.sudo('systemctl start apache2.service') diff --git a/rattail_fabric2/collectd.py b/rattail_fabric2/collectd.py index 8521704..1528825 100644 --- a/rattail_fabric2/collectd.py +++ b/rattail_fabric2/collectd.py @@ -59,7 +59,7 @@ def restart(c): """ Restart the collectd service. """ - c.sudo("service collectd restart") + c.sudo('systemctl restart collectd') def deploy_mountpoint_check_script(c, dest, **kwargs): diff --git a/rattail_fabric2/mysql.py b/rattail_fabric2/mysql.py index f3dc5df..f3b62aa 100644 --- a/rattail_fabric2/mysql.py +++ b/rattail_fabric2/mysql.py @@ -66,7 +66,7 @@ def restart(c): """ Restart the MySQL database service """ - c.sudo("service mysql restart") + c.sudo('systemctl restart mysql.service') def user_exists(c, name, host='localhost'): diff --git a/rattail_fabric2/nodejs.py b/rattail_fabric2/nodejs.py index 7300311..c35999c 100644 --- a/rattail_fabric2/nodejs.py +++ b/rattail_fabric2/nodejs.py @@ -50,8 +50,8 @@ def install(c, version=None, user=None): c.sudo(f'touch {profile}') c.sudo(f'chown {user}: {profile}') append(c, profile, 'export NVM_DIR="{}"'.format(nvm), **kwargs) - append(c, profile, '[ -s "$NVM_DIR/nvm.sh" ] && \\. "$NVM_DIR/nvm.sh"', **kwargs) - append(c, profile, '[ -s "$NVM_DIR/bash_completion" ] && \\. "$NVM_DIR/bash_completion"', **kwargs) + append(c, profile, '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"', **kwargs) + append(c, profile, '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"', **kwargs) node = version or 'node' cmd = "bash -l -c 'nvm install {}'".format(node) diff --git a/rattail_fabric2/postfix.py b/rattail_fabric2/postfix.py index 1923c01..ed17d04 100644 --- a/rattail_fabric2/postfix.py +++ b/rattail_fabric2/postfix.py @@ -62,7 +62,7 @@ def restart(c): """ Restart the Postfix mail service """ - c.sudo("service postfix restart") + c.sudo('systemctl restart postfix.service') def set_config(c, setting, value): diff --git a/rattail_fabric2/postgresql.py b/rattail_fabric2/postgresql.py index bc5f5ae..d524d78 100644 --- a/rattail_fabric2/postgresql.py +++ b/rattail_fabric2/postgresql.py @@ -93,14 +93,14 @@ def restart(c): """ Restart the PostgreSQL database service """ - c.sudo("service postgresql restart") + c.sudo('systemctl restart postgresql.service') def reload_(c): """ Reload config for the PostgreSQL database service """ - c.sudo("service postgresql reload") + c.sudo('systemctl reload postgresql.service') # TODO: deprecate / remove this reload = reload_ diff --git a/rattail_fabric2/ssh.py b/rattail_fabric2/ssh.py index f42a6cd..6a88f48 100644 --- a/rattail_fabric2/ssh.py +++ b/rattail_fabric2/ssh.py @@ -65,7 +65,7 @@ def restart(c): """ Restart the OpenSSH service """ - c.sudo("service ssh restart") + c.sudo('systemctl restart ssh.service') def configure(c, allow_root=False): diff --git a/rattail_fabric2/util.py b/rattail_fabric2/util.py index e74d168..50381cf 100644 --- a/rattail_fabric2/util.py +++ b/rattail_fabric2/util.py @@ -154,8 +154,8 @@ def is_win(c): """ Return True if remote SSH server is running Windows, False otherwise. - The idea is based on echoing quoted text: \\*NIX systems will echo - quoted text only, while Windows echoes quotation marks as well. + The idea is based on echoing quoted text: \*NIX systems will echo quoted + text only, while Windows echoes quotation marks as well. .. note:: @@ -170,7 +170,7 @@ def _expand_path(c, path): Return a path expansion E.g. ~/some/path -> /home/myuser/some/path - /user/\\*/share -> /user/local/share + /user/\*/share -> /user/local/share More examples can be found here: http://linuxcommand.org/lc3_lts0080.php .. versionchanged:: 1.0 @@ -207,10 +207,10 @@ def sed(c, filename, before, after, limit='', use_sudo=False, backup='.bak', ``. Setting ``backup`` to an empty string will, disable backup file creation. - For convenience, ``before`` and ``after`` will automatically - escape forward slashes, single quotes and parentheses for you, so - you don't need to specify e.g. ``http:\\/\\/foo\\.com``, instead - just using ``http://foo\\.com`` is fine. + For convenience, ``before`` and ``after`` will automatically escape forward + slashes, single quotes and parentheses for you, so you don't need to + specify e.g. ``http:\/\/foo\.com``, instead just using ``http://foo\.com`` + is fine. If ``use_sudo`` is True, will use `sudo` instead of `run`.