Giter Club home page Giter Club logo

servicectl's Introduction

Control daemons for systemd in chroot environment

Servicectl - bash script start/stop service (daemons) for linux using systemd in chroot and SysVinit outside the chroot environment. servicectl management daemon uses the service files of systemd, e.g. /usr/lib/systemd/system/nginx.service

Introduction

Systemd is not working in chroot environment:

sudo systemctl start nginx
Running in chroot, ignoring request.

If your base system (outside chroot):

Requare for chroot system (inside chroot):

  • installed systemd

Installation

Packages:

ArchLinux - https://aur.archlinux.org/packages/servicectl/

Manual:

wget https://github.com/smaknsk/servicectl/archive/1.0.tar.gz
tar -xf 1.0.tar.gz -C /usr/local/lib/
ln -s /usr/local/lib/servicectl-1.0/servicectl /usr/local/bin/servicectl
ln -s /usr/local/lib/servicectl-1.0/serviced /usr/local/bin/serviced

Usage

servicectl

sudo servicectl action service

This command just exec ${action} from file /usr/lib/systemd/system/${service}.service If passed action enable or disable, servicectl create or delete symlink on ${service}.service for use serviced.

Params:

  • action - can be {start, stop, restart, reload, enable, disable}
  • service - file name in folder /usr/lib/systemd/system/

serviced

sudo serviced action

This command exec ${action} for all enable services.

Params:

  • action - by default start, can be {start, stop, restart, reload, disable}

Example

I'm using chrome os as the base system and archlinux in chroot environment.

# inside chroot
sudo servicectl enable nginx php-fpm

# outside chroot: 
# init startup and run all enabled daemons
sudo chroot /path/to/chroot serviced

If you know how to do it better, let me know =) Good luck

servicectl's People

Contributors

smaknsk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.