logo
Tags down

shadow

Start service using systemctl inside docker conatiner


By : super rocker
Date : October 17 2020, 01:08 AM
I wish this helpful for you When you do docker run with bash as the command, the init system (e.g. SystemD) doesn’t get started (nor does your start script, since the command you pass overrides the CMD in the Dockerfile). Try to change the command you use to /sbin/init, start the container in daemon mode with -d, and then look around in a shell using docker exec -it sh.
code :


Share : facebook icon twitter icon

Docker Lamp Centos7: '/bin/sh -c systemctl start httpd.service' returned a non-zero code: 1


By : Don Levin
Date : March 29 2020, 07:55 AM
wish helps you First of all, welcome to Docker! :-) Loads of Docker tutorials and docs are written around Ubuntu containers, but I like Centos too.
Ok, there are a couple of things to talk about here:

Docker Container won't start with systemctl


By : Tao Li
Date : March 29 2020, 07:55 AM
wish of those help You are running redis container in detached mode so docker utility starts container and then exits. From systemd point of view this looks like controlled process exited so systemd executes ExecStop script which in your case stops redis container.
You need to keep process running so systemd won't try to stop or restart your container. One way to achieve this is to remove --detach flag. You can also use KillMode=none so systemd won't send SIGTERM to docker utility but will execute only ExecStop instead.
code :
[Unit]
Requires=docker.service
After=docker.service

[Service]
TimeoutStartSec=0
KillMode=none
Restart=always
RestartSec=5s


ExecStartPre=-/usr/bin/docker kill %p
ExecStartPre=-/usr/bin/docker rm -v %p

ExecStart=/usr/bin/docker --name=redis --publish=6379:6379 redis

ExecStop=/usr/bin/docker stop %p
ExecStopPost=-/usr/bin/docker stop %p

Autossh script running as systemctl start SERVICE works but systemctl enable SERVICE failed


By : payamasllee
Date : March 29 2020, 07:55 AM
like below fixes the issue Instead of After=network.target, use After=network-online.target.
More about systemd network targets are documented on the systemd wiki page.

Centos 7 - service from /etc/systemd/system/san.service not running with systemctl start san.service


By : Shikha Saurav
Date : March 29 2020, 07:55 AM
around this issue I followed instructions from this link: https://www.thegeekdiary.com/centos-rhel-7-how-to-make-custom-script-to-run-automatically-during-boot/ , Change startSanic2.sh to:
code :
#!/bin/bash

/opt/horses/startSanic.sh
$ sudo chmod +x /opt/horses/startSanic2.sh
$ sudo chmod +x /opt/horses/startSanic.sh
$ sudo systemctl daemon-reload
$ sudo systemctl enable san.service
$ sudo systemctl start san.service
[Unit]
Description=Description for sample script goes here
After=network.target

[Service]
Type=simple
ExecStart=/opt/horses/startSanic2.sh
TimeoutStartSec=0
Environment="REDIS_HOST=192.168.150.220"
Environment="REDIS_PORT=6379"

[Install]
WantedBy=default.target

How can I start my prolog web service using a systemctl service on a linux server?


By : Pramod A Dudhane
Date : March 29 2020, 07:55 AM
hop of those help? The solution to this problem was given to me by a user in an external PROLOG forum.
Here's the answer:
code :
    # swi-prolog - SWISH server
    [Unit]
      Description=SWISH
    [Service]
      UMask=022
      Environment=LANG=en_US.utf8
      Restart=on-failure
      LimitCORE=infinity
      StartLimitInterval=60
      StartLimitBurst=5
      WorkingDirectory=/home/swish/src/swish
      ExecReload=/bin/kill -HUP $MAINPID
      ExecStart=/home/swish/bin/swipl swish-daemon.pl --no-fork --port=80 --user=www-data --workers=4
    [Install]
      WantedBy=multi-user.target
shadow
Privacy Policy - Terms - Contact Us © soohba.com