Control services (daemons) for systemd in chroot environment
See the codeServicectl - 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
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):
ArchLinux - https://aur.archlinux.org/packages/servicectl/
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
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:
sudo serviced action
This command exec ${action} for all enable services.
Params:
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
Shell
100.0%
Control services (daemons) for systemd in chroot environment
See the codeServicectl - 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
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):
ArchLinux - https://aur.archlinux.org/packages/servicectl/
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
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:
sudo serviced action
This command exec ${action} for all enable services.
Params:
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
Shell
100.0%