Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

2 votes
2 answers
10098 views
How to deal with "A stop job is running" in Debian 9 for 90s, once every 2 or 3 shutdowns?
When I'm turning my Debian Stretch (9) off, chances are that I see something like: [![screenshot showing "A stop job is running for ...f user Debian-gdm (59s / 1min 30s)"][1]][1] So a have a few questions: 1) It seems like a bug that's not been solved yet (it's been around for a few years). By "bug"...
When I'm turning my Debian Stretch (9) off, chances are that I see something like: screenshot showing So a have a few questions: 1) It seems like a bug that's not been solved yet (it's been around for a few years). By "bug" I mean Linux should turn off faster than Windows; if it doesn't, there's a bug. 2) Since this bug seems hard to isolate and solve, maybe a "Esc to cancel" would solve a big part of the problem. 3) I have programming experience, but not with Linux Kernel and such. Am I advised to try to include "Esc to cancel" myself? If so, which file should I change? May I compile only this file, or something more? EDIT Contents of /etc/gdm3/daemon.conf # GDM configuration storage # # See /usr/share/gdm/gdm.schemas for a list of available options. [daemon] # Uncoment the line below to force the login screen to use Xorg #WaylandEnable=false # Enabling automatic login # AutomaticLoginEnable = true # AutomaticLogin = user1 # Enabling timed login # TimedLoginEnable = true # TimedLogin = user1 # TimedLoginDelay = 10 [security] [xdmcp] [chooser] [debug] # Uncomment the line below to turn on debugging # More verbose logs # Additionally lets the X server dump core if it crashes #Enable=true
Rodrigo (1894 rep)
Jan 25, 2019, 03:57 PM • Last activity: Jun 7, 2025, 11:01 AM
4 votes
1 answers
3628 views
start-stop-daemon, services, environment variables, and ansible
So, I have a Java program that runs Ansible. I'd like to run this program as a service. I've written a service script in /etc/init.d that uses start-stop-daemon to run/stop the Java program. I've run into a problem where Ansible fails with this error: GATHERING FACTS ********************************...
So, I have a Java program that runs Ansible. I'd like to run this program as a service. I've written a service script in /etc/init.d that uses start-stop-daemon to run/stop the Java program. I've run into a problem where Ansible fails with this error:
GATHERING FACTS *************************************************************** 
fatal: [i-0f55b6a4] => Could not make dir /$HOME/.ansible/cp: [Errno 13] Permission denied: '/$HOME'
Ansible is trying to create a temporary work directory under /$HOME but for some reason, $HOME does not evaluate to /home/ubuntu (even though I used --user ubuntu --chuid ubuntu when starting the service), so it looks like Ansible tries to create a directory with the literal name /$HOME. And then it fails, because it lacks the permission to do this. This is not a configurable option, so I did some digging and I *think* I found exactly where Ansible is trying to do this: https://github.com/ansible/ansible/blob/5ce3988d8693357f671f3fbec43b2d3b862db5f6/v1/ansible/runner/connection_plugins/ssh.py#L56 The python snippet, in case that link ever goes bad is: def __init__(self, runner, host, port, user, password, private_key_file, *args, **kwargs): ... fcntl.lockf(self.runner.process_lockfile, fcntl.LOCK_EX) self.cp_dir = utils.prepare_writeable_dir('$HOME/.ansible/cp',mode=0700) fcntl.lockf(self.runner.process_lockfile, fcntl.LOCK_UN) I've tried a couple of things to resolve this, but so far nothing has worked. Some of the things I've tried include: Using /usr/bin/env to set HOME (since my version of start-stop-daemon does not appear to support --env): CMD="/usr/bin/java" CMD_ARGS=#...not really relevant here case "$1" in start) start-stop-daemon --start -b -m --no-close --pidfile $PID_FILE --user ubuntu --chuid ubuntu --exec /usr/bin/env HOME=/home/ubuntu -- $CMD $CMD_ARGS >> $LOG_FILE 2>&1 Alas, this did not work. I tried generating a wrapper script that will set the variable and then execute the main program: case "$1" in start) sudo cat /tmp/runMyProcess.sh #! /bin/bash HOME=/home/ubuntu env $CMD $CMD_ARGS >> $LOG_FILE 2>&1 PROCESS_RUNNER sudo chmod a+x /tmp/runMyProcess.sh start-stop-daemon --start -b -m --no-close --pidfile $PID_FILE --user ubuntu --chuid ubuntu --exec /tmp/runMyProcess.sh The wrapper script looks like this: #! /bin/bash HOME=/home/ubuntu env /usr/bin/java -cp /home/ubuntu/arch3/pancancer.jar com.mypackage.MyClass --some --arguments >> /var/log/myApplication/MyClass.log 2>&1 This also did not work. When the Java program is called directly from the command line, everything works fine. Ansible is being called from a Java program that is being called from start-stop-daemon that is being called from service. I'm not sure how I can propagate an environment variable named $HOME to ansible, and I'm kinda stumped right now.
FrustratedWithFormsDesigner (330 rep)
Aug 7, 2015, 05:48 PM • Last activity: May 18, 2025, 07:03 PM
2 votes
1 answers
148 views
start-stop-daemon does not start because: "process already running"
I have an init script to start qbittorrent-nox on my server. It works fine when I first start the server, but if I shut down the qbittorrent-nox process (`service qbittorrent stop`) it will not start again (`service qbittorrent start`), with this error: process already running. I am sure there is no...
I have an init script to start qbittorrent-nox on my server. It works fine when I first start the server, but if I shut down the qbittorrent-nox process (service qbittorrent stop) it will not start again (service qbittorrent start), with this error: process already running. I am sure there is no process running, I looked with ps. this is the exact command to start:
start-stop-daemon --start --chdir '/home/testuser' --user 'testuser' --chuid 'testuser:testuser' --startas /usr/bin/env HOME="/home/testuser" /usr/bin/qbittorrent-nox
There are no files in /run related to qbittorrent.
Martin Vegter (586 rep)
Nov 30, 2024, 06:11 AM • Last activity: Nov 30, 2024, 07:43 AM
0 votes
0 answers
27 views
daemon-reload behavior in systemd's ExecStartPre
I have a unit file `myservice.service` that looks like this: ``` ... ExecStartPre=prehook.sh ... ExecStart=myapp ExecStopPost=posthook.sh ... ``` prehook.sh performs various things, and, among the others, it replaces the unit file if it differs from a local copy and invokes `daemon-reload`: ``` ......
I have a unit file myservice.service that looks like this:
...
ExecStartPre=prehook.sh
...
ExecStart=myapp
ExecStopPost=posthook.sh
...
prehook.sh performs various things, and, among the others, it replaces the unit file if it differs from a local copy and invokes daemon-reload:
...
# Compare files
if cmp -s "$SYSTEMD_FILE" "$LOCAL_FILE"; then
  echo "Unit files are identical. No update required."
else
  echo "Unit files differ. Updating systemd unit file."
  
  # Copy local version to /lib/systemd/system
  cp "$LOCAL_FILE" "$SYSTEMD_FILE"
  systemctl daemon-reload
  
  echo "Systemd configuration reloaded"
fi

#continue with something else
...
The local copy differs from the currently loaded unit file in the ExecStart line:
...
ExecStart=myappModified
...
The behavior I would expect is that, if unit file is changed during ExecStartPre, daemon-reload affects only subsequent invocations of systemctl start myservice, not the current one. Surprisingly, systemd seems to reload "on the fly" the ExecStart line, honoring what is indicated in the local copy. While this is a convenient behavior for the prehook script, I cannot find any evidence of this in the documentation. Am I overlooking something? Systemd version is 240.
LDC (1 rep)
Oct 20, 2024, 02:09 PM
16 votes
3 answers
88002 views
How to fix ".service: Start request repeated too quickly." on custom service?
I'm learning how to create services with systemd. I get this error: .service: Start request repeated too quickly. I can't start the service any more; it was working yesterday. What am I doing wrong? (root@Kundrum)-(11:03:19)-(~) $nano /lib/systemd/system/swatchWATCH.service 1 [Unit] 2 Description=Mo...
I'm learning how to create services with systemd. I get this error: .service: Start request repeated too quickly. I can't start the service any more; it was working yesterday. What am I doing wrong? (root@Kundrum)-(11:03:19)-(~) $nano /lib/systemd/system/swatchWATCH.service 1 [Unit] 2 Description=Monitor Logfiles and send Mail reports 3 After=syslog.target network.target 4 5 [Service] 6 Type=simple 7 ExecStart=/usr/bin/swatch --config-file=/home/kristjan/.swatchrc --input-record-separator="\n \n " --tail-file=/var/log/snort/alert --daemon 8 Restart=on-failure 9 StartLimitInterval=3 10 StartLimitBurst=100 11 12 [Install] 13 WantedBy=multi-user.target StartLimitInterval and StartLimitBurst I added after trying to fix it. My system is Debian 9.8 Stretch all updates.
somethingSomething (6209 rep)
May 8, 2019, 11:07 AM • Last activity: Oct 2, 2024, 05:04 PM
2 votes
0 answers
3846 views
dockerd failed to start daemon: list bridge addresses failed
Exacactly the same issue as https://unix.stackexchange.com/questions/607477/failed-to-start-docker-container-engin, as I'm getting `dockerd failed to start daemon: Error initializing network controller: list bridge addresses failed: PredefinedLocalScopeDefaultNetworks List no available network`: $ j...
Exacactly the same issue as https://unix.stackexchange.com/questions/607477/failed-to-start-docker-container-engin , as I'm getting dockerd failed to start daemon: Error initializing network controller: list bridge addresses failed: PredefinedLocalScopeDefaultNetworks List no available network: $ journalctl -xeu docker.service | grep 'failed to start daemon' Nov 23 21:56:08 myhost dockerd: failed to start daemon: Error initializing network controller: list bridge addresses failed: PredefinedLocalScopeDefaultNetworks List: [172.17.0.0/16 172.18.0.0/16 172.19.0.0/16 172.20.0.0/16 172.21.0.0/16 172.22.0.0/16 172.23.0.0/16 172.24.0.0/16 172.25.0.0/16 172.26.0.0/16 172.27.0.0/16 172.28.0.0/16 172.29.0.0/16 172.30.0.0/16 172.31.0.0/16 192.168.0.0/20 192.168.16.0/20 192.168.32.0/20 192.168.48.0/20 192.168.64.0/20 192.168.80.0/20 192.168.96.0/20 192.168.112.0/20 192.168.128.0/20 192.168.144.0/20 192.168.160.0/20 192.168.176.0/20 192.168.192.0/20 192.168.208.0/20 192.168.224.0/20 192.168.240.0/20]: no available network But that solution doesn't work for me. And I've found out the reason is that there is no --bip flag any more to docker:
/usr/bin/docker daemon --debug --bip=192.168.0.0/20
unknown flag: --bip
See 'docker --help'.
What I [found](https://github.com/docker/for-linux/issues/123) works is:
ip link add name docker0 type bridge
 ip addr add dev docker0 172.17.0.1/16
 systemctl daemon-reload
 systemctl start docker
However, I believe such change won't be persistent over reboot, thus need a permanent solution.
xpt (1858 rep)
Nov 24, 2021, 03:35 AM • Last activity: Jan 13, 2023, 04:07 AM
2 votes
1 answers
2404 views
start-stop-daemon no pid file was written
Have already --make-pidfile in start-stop-daemon, but still couldn't see pid file being created. Anybody can help why? #!/bin/bash ### BEGIN INIT INFO # FIXME: set Provides and Short-Description # Provides: echobridge # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default...
Have already --make-pidfile in start-stop-daemon, but still couldn't see pid file being created. Anybody can help why? #!/bin/bash ### BEGIN INIT INFO # FIXME: set Provides and Short-Description # Provides: echobridge # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: initscript for echobridge ### END INIT INFO # FIXME: your name here # Author: Leonid Shevtsov # Do NOT "set -e" PATH=/sbin:/usr/sbin:/bin:/usr/bin # FIXME: configure your app here DESC="home automation phillips hue emulator" NAME="echobridge" CWD=/home/pi/EchoBridge DATA=/home/pi/EchoBridge/data #IP=128.168.1.40 #PORT=80 USER=pi GROUP=pi JAVA="/usr/bin/java" JVM_ARGS="-Dconfig.file=$DATA/habridge.config" JAR_PATH=/home/pi/EchoBridge/ha-bridge-3.2.1.jar #JAR_PATH=/home/pi/EchoBridge/ha-bridge-3.1.0.jar JAVA_ARGS="$JVM_ARGS -jar $JAR_PATH" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh # Define LSB log_* functions. # Depend on lsb-base (>= 3.2-14) to ensure that this file is present # and status_of_proc is working. . /lib/lsb/init-functions # Test that Java is installed if [ ! -x "$JAVA" ]; then echo "Java executable not found at $JAVA" exit 2 fi # Test that the application jar is present if [ ! -r "$JAR_PATH" ]; then echo "Application JAR not found at $JAR_PATH" exit 2 fi # # Function that starts the daemon/service # do_start() { # Return # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started start-stop-daemon --start \ --quiet \ # --name $NAME \ --make-pidfile \ --pidfile $PIDFILE \ --exec $JAVA \ --test > /dev/null \ || return 1 # FIXME: export environment variables here # export PORT=8070 start-stop-daemon --start \ --quiet \ # --name $NAME \ --make-pidfile \ --pidfile $PIDFILE \ # --chuid $USER:$GROUP \ --chdir $CWD \ --background \ --exec $JAVA \ -- $JAVA_ARGS \ || return 2 } # # Function that stops the daemon/service # do_stop() { # Return # 0 if daemon has been stopped # 1 if daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred start-stop-daemon --stop \ --quiet \ # --name $NAME \ --pidfile $PIDFILE \ --exec $JAVA \ --retry=TERM/30/KILL/5 RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 rm -f $PIDFILE return "$RETVAL" } # # Function that checks if the daemon is running # do_status() { start-stop-daemon \ --start \ --test \ --oknodo \ --pidfile $PIDFILE \ --exec $JAVA } case "$1" in start) [ "$VERBOSE" != no ] && echo "Starting $DESC" "$NAME" do_start case "$?" in 0|1) [ "$VERBOSE" != no ] && echo 0 ;; 2) [ "$VERBOSE" != no ] && echo 1 ;; esac ;; stop) [ "$VERBOSE" != no ] && echo "Stopping $DESC" "$NAME" do_stop case "$?" in 0|1) [ "$VERBOSE" != no ] && echo 0 ;; 2) [ "$VERBOSE" != no ] && echo 1 ;; esac ;; status) do_status ;; restart|force-reload) echo "Restarting $DESC" "$NAME" do_stop case "$?" in 0|1) do_start case "$?" in 0) echo 0 ;; 1) echo 1 ;; # Old process is still running *) echo 1 ;; # Failed to start esac ;; *) # Failed to stop echo 1 ;; esac ;; *) echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 exit 3 ;; esac***
dondon (21 rep)
Nov 11, 2016, 09:20 PM • Last activity: Dec 8, 2022, 09:03 AM
1 votes
0 answers
1246 views
MongoDB 6 fails to start on CentOS 8
MongoDb run fine with the default settings. The issue occurs when I change the default log path in `cat /etc/mongod.conf` to the below: systemLog: destination: file logAppend: true path: /var/www/logs/mongodb/mongod.log Below are my steps to install and start `mongod` While the installation shows su...
MongoDb run fine with the default settings. The issue occurs when I change the default log path in cat /etc/mongod.conf to the below: systemLog: destination: file logAppend: true path: /var/www/logs/mongodb/mongod.log Below are my steps to install and start mongod While the installation shows successful mongod fails to start after log path update in the /etc/mongod.conf. # cat /etc/yum.repos.d/mongodb-org.repo [mongodb-org-6.0] name=MongoDB Repository #baseurl=https://repo.mongodb.org/yum/redhat//mongodb-org/6.0/x86_64/ baseurl=https://repo.mongodb.org/yum/redhat/8Server/mongodb-org/6.0/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc #Script to install and run mongod echo "Installing mongodb" sudo yum install -y mongodb-org mkdir -p "$log_location/mongodb" sudo systemctl start mongod echo "Status mongodb" sudo systemctl status mongod --no-pager Output: Installing mongodb MongoDB Repository 5.8 kB/s | 9.4 kB 00:01 Package mongodb-org-4.0.28-1.el8.x86_64 is already installed. Dependencies resolved. ========================================================================================================================================================================================= Package Architecture Version Repository Size ========================================================================================================================================================================================= Upgrading: mongodb-org x86_64 6.0.1-1.el8 mongodb-org-6.0 11 k mongodb-org-tools x86_64 6.0.1-1.el8 mongodb-org-6.0 11 k Installing dependencies: cyrus-sasl x86_64 2.1.27-6.el8_5 baseos 96 k mongodb-database-tools x86_64 100.6.0-1 mongodb-org-6.0 48 M mongodb-mongosh x86_64 1.5.4-1.el8 mongodb-org-6.0 41 M mongodb-org-database x86_64 6.0.1-1.el8 mongodb-org-6.0 11 k mongodb-org-database-tools-extra x86_64 6.0.1-1.el8 mongodb-org-6.0 16 k Transaction Summary ========================================================================================================================================================================================= Install 5 Packages Upgrade 2 Packages Total download size: 89 M Downloading Packages: (1/7): mongodb-mongosh-1.5.4.x86_64.rpm 51 MB/s | 41 MB 00:00 (2/7): mongodb-database-tools-100.6.0.x86_64.rpm 50 MB/s | 48 MB 00:00 (3/7): mongodb-org-database-6.0.1-1.el8.x86_64.rpm 43 kB/s | 11 kB 00:00 (4/7): mongodb-org-database-tools-extra-6.0.1-1.el8.x86_64.rpm 66 kB/s | 16 kB 00:00 (5/7): mongodb-org-6.0.1-1.el8.x86_64.rpm 44 kB/s | 11 kB 00:00 (6/7): mongodb-org-tools-6.0.1-1.el8.x86_64.rpm 41 kB/s | 11 kB 00:00 (7/7): cyrus-sasl-2.1.27-6.el8_5.x86_64.rpm 6.5 kB/s | 96 kB 00:14 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 5.8 MB/s | 89 MB 00:15 MongoDB Repository 660 B/s | 1.7 kB 00:02 Importing GPG key 0x64C3C388: Userid : "MongoDB 6.0 Release Signing Key " Fingerprint: 39BD 841E 4BE5 FB19 5A65 400E 6A26 B1AE 64C3 C388 From : https://www.mongodb.org/static/pgp/server-6.0.asc Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : mongodb-org-database-tools-extra-6.0.1-1.el8.x86_64 1/9 Installing : mongodb-org-database-6.0.1-1.el8.x86_64 2/9 Installing : mongodb-mongosh-1.5.4-1.el8.x86_64 3/9 Running scriptlet: cyrus-sasl-2.1.27-6.el8_5.x86_64 4/9 Installing : cyrus-sasl-2.1.27-6.el8_5.x86_64 4/9 Running scriptlet: cyrus-sasl-2.1.27-6.el8_5.x86_64 4/9 Running scriptlet: mongodb-database-tools-100.6.0-1.x86_64 5/9 Installing : mongodb-database-tools-100.6.0-1.x86_64 5/9 Running scriptlet: mongodb-database-tools-100.6.0-1.x86_64 5/9 Upgrading : mongodb-org-tools-6.0.1-1.el8.x86_64 6/9 Upgrading : mongodb-org-6.0.1-1.el8.x86_64 7/9 Cleanup : mongodb-org-4.0.28-1.el8.x86_64 8/9 Cleanup : mongodb-org-tools-4.0.28-1.el8.x86_64 9/9 Running scriptlet: mongodb-org-tools-4.0.28-1.el8.x86_64 9/9 Verifying : cyrus-sasl-2.1.27-6.el8_5.x86_64 1/9 Verifying : mongodb-database-tools-100.6.0-1.x86_64 2/9 Verifying : mongodb-mongosh-1.5.4-1.el8.x86_64 3/9 Verifying : mongodb-org-database-6.0.1-1.el8.x86_64 4/9 Verifying : mongodb-org-database-tools-extra-6.0.1-1.el8.x86_64 5/9 Verifying : mongodb-org-6.0.1-1.el8.x86_64 6/9 Verifying : mongodb-org-4.0.28-1.el8.x86_64 7/9 Verifying : mongodb-org-tools-6.0.1-1.el8.x86_64 8/9 Verifying : mongodb-org-tools-4.0.28-1.el8.x86_64 9/9 Upgraded: mongodb-org-6.0.1-1.el8.x86_64 mongodb-org-tools-6.0.1-1.el8.x86_64 Installed: cyrus-sasl-2.1.27-6.el8_5.x86_64 mongodb-database-tools-100.6.0-1.x86_64 mongodb-mongosh-1.5.4-1.el8.x86_64 mongodb-org-database-6.0.1-1.el8.x86_64 mongodb-org-database-tools-extra-6.0.1-1.el8.x86_64 Complete! Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details. Status mongodb ● mongod.service - MongoDB Database Server Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Mon 2022-09-05 06:36:08 UTC; 75ms ago Docs: https://docs.mongodb.org/manual Process: 33739 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=1/FAILURE) Process: 33736 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS) Process: 33735 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS) Process: 33733 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS) Sep 05 06:36:08 DKERP systemd: Starting MongoDB Database Server... Sep 05 06:36:08 DKERP mongod: about to fork child process, waiting until server is ready for connections. Sep 05 06:36:08 DKERP mongod: forked process: 33741 Sep 05 06:36:08 DKERP mongod: ERROR: child process failed, exited with error number 1 Sep 05 06:36:08 DKERP mongod: To see additional information in this output, start without the "--fork" option. Sep 05 06:36:08 DKERP systemd: mongod.service: Control process exited, code=exited status=1 Sep 05 06:36:08 DKERP systemd: mongod.service: Failed with result 'exit-code'. Sep 05 06:36:08 DKERP systemd: Failed to start MongoDB Database Server. One suggestion was to start after trying this command sudo systemctl daemon-reload however that too did not work for me. Unfortunately, nothing shows in the logs as evident from below output: [root@vultr ~]# grep log /etc/mongod.conf # where to write logging data. logAppend: true path: /var/www/logs/mongodb/mongod.log [root@vultr ~]# cat /var/www/logs/mongodb/mongod.log | wc -l cat: /var/www/logs/mongodb/mongod.log: No such file or directory 0 I'm doing mongo 6 on centos8 [root@vultr ~]# uname -a Linux DKERP 4.18.0-408.el8.x86_64 #1 SMP Mon Jul 18 17:42:52 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux [root@vultr ~]# hostnamectl Static hostname: DKERP Icon name: computer-vm Chassis: vm Machine ID: c07ca36f4c37437f8c6c6cbb7d73daf1 Boot ID: 83ee4a5872024054be50448423a9f5e7 Virtualization: microsoft Operating System: CentOS Stream 8 CPE OS Name: cpe:/o:centos:centos:8 Kernel: Linux 4.18.0-408.el8.x86_64 Architecture: x86-64 Removed the fork option from configuration file and here is the details debug: [root@vultr ~]# journalctl -xe Sep 05 10:20:26 DKERP systemd: Starting MongoDB Database Server... -- Subject: Unit mongod.service has begun start-up -- Defined-By: systemd -- Support: https://access.redhat.com/support -- -- Unit mongod.service has begun starting up. Sep 05 10:20:26 DKERP mongod: 2022-09-05T10:20:26.596+0000 F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/var/www/logs/mongodb/mongod.log" Sep 05 10:20:26 DKERP systemd: mongod.service: Control process exited, code=exited status=1 Sep 05 10:20:26 DKERP dbus-daemon: [system] Activating via systemd: service name='org.fedoraproject.Setroubleshootd' unit='setroubleshootd.service' requested by ':1.239' (uid=0 pi> Sep 05 10:20:26 DKERP systemd: mongod.service: Failed with result 'exit-code'. -- Subject: Unit failed -- Defined-By: systemd -- Support: https://access.redhat.com/support -- -- The unit mongod.service has entered the 'failed' state with result 'exit-code'. Sep 05 10:20:26 DKERP systemd: Failed to start MongoDB Database Server. -- Subject: Unit mongod.service has failed -- Defined-By: systemd -- Support: https://access.redhat.com/support -- -- Unit mongod.service has failed. -- -- The result is failed. Sep 05 10:20:26 DKERP systemd: Starting SETroubleshoot daemon for processing new SELinux denial logs... -- Subject: Unit setroubleshootd.service has begun start-up -- Defined-By: systemd -- Support: https://access.redhat.com/support -- -- Unit setroubleshootd.service has begun starting up. Sep 05 10:20:26 DKERP sudo: pam_unix(sudo:session): session closed for user root Sep 05 10:20:27 DKERP dbus-daemon: [system] Successfully activated service 'org.fedoraproject.Setroubleshootd' Sep 05 10:20:27 DKERP systemd: Started SETroubleshoot daemon for processing new SELinux denial logs. -- Subject: Unit setroubleshootd.service has finished start-up -- Defined-By: systemd -- Support: https://access.redhat.com/support -- -- Unit setroubleshootd.service has finished starting up. -- -- The start-up result is done. Sep 05 10:20:28 DKERP setroubleshoot: AnalyzeThread.run(): Cancel pending alarm Sep 05 10:20:28 DKERP dbus-daemon: [system] Activating service name='org.fedoraproject.SetroubleshootPrivileged' requested by ':1.917' (uid=995 pid=34827 comm="/usr/libexec/platfo> Sep 05 10:20:28 DKERP dbus-daemon: [system] Successfully activated service 'org.fedoraproject.SetroubleshootPrivileged' Sep 05 10:20:29 DKERP setroubleshoot: SELinux is preventing /usr/bin/mongod from read access on the file memory.limit_in_bytes. For complete SELinux messages run: sealert -l 8a0> Sep 05 10:20:29 DKERP setroubleshoot: SELinux is preventing /usr/bin/mongod from read access on the file memory.limit_in_bytes. ***** Plugin catchall (100. confidence) suggests ************************** If you believe that mongod should be allowed read access on the memory.limit_in_bytes file by default. Then you should report this as a bug. You can generate a local policy module to allow this access. Do allow this access for now by executing: # ausearch -c 'mongod' --raw | audit2allow -M my-mongod # semodule -X 300 -i my-mongod.pp Sep 05 10:20:29 DKERP setroubleshoot: AnalyzeThread.run(): Set alarm timeout to 10 I then decided to temporarily disable selinux however, I still get the below error: [root@vultr ~]# journalctl -xe Sep 05 10:26:43 DKERP systemd: Started SETroubleshoot daemon for processing new SELinux denial logs. -- Subject: Unit setroubleshootd.service has finished start-up -- Defined-By: systemd -- Support: https://access.redhat.com/support -- -- Unit setroubleshootd.service has finished starting up. -- -- The start-up result is done. Sep 05 10:26:43 DKERP setroubleshoot: AnalyzeThread.run(): Cancel pending alarm Sep 05 10:26:43 DKERP dbus-daemon: [system] Activating service name='org.fedoraproject.SetroubleshootPrivileged' requested by ':1.949' (uid=995 pid=34922 comm="/usr/libexec/platfo> Sep 05 10:26:44 DKERP dbus-daemon: [system] Successfully activated service 'org.fedoraproject.SetroubleshootPrivileged' Sep 05 10:26:44 DKERP setroubleshoot: SELinux is preventing /usr/bin/mongod from read access on the file memory.limit_in_bytes. For complete SELinux messages run: sealert -l 8a0> Sep 05 10:26:44 DKERP setroubleshoot: SELinux is preventing /usr/bin/mongod from read access on the file memory.limit_in_bytes. ***** Plugin catchall (100. confidence) suggests ************************** If you believe that mongod should be allowed read access on the memory.limit_in_bytes file by default. Then you should report this as a bug. You can generate a local policy module to allow this access. Do allow this access for now by executing: # ausearch -c 'mongod' --raw | audit2allow -M my-mongod # semodule -X 300 -i my-mongod.pp Sep 05 10:26:44 DKERP setroubleshoot: AnalyzeThread.run(): Set alarm timeout to 10 Sep 05 10:26:44 DKERP setroubleshoot: AnalyzeThread.run(): Cancel pending alarm Sep 05 10:26:44 DKERP setroubleshoot: SELinux is preventing /usr/bin/mongod from read access on the file memory.limit_in_bytes. For complete SELinux messages run: sealert -l 8a0> Sep 05 10:26:44 DKERP setroubleshoot: SELinux is preventing /usr/bin/mongod from read access on the file memory.limit_in_bytes. ***** Plugin catchall (100. confidence) suggests ************************** If you believe that mongod should be allowed read access on the memory.limit_in_bytes file by default. Then you should report this as a bug. You can generate a local policy module to allow this access. Do allow this access for now by executing: # ausearch -c 'mongod' --raw | audit2allow -M my-mongod # semodule -X 300 -i my-mongod.pp Sep 05 10:26:44 DKERP setroubleshoot: AnalyzeThread.run(): Set alarm timeout to 10 Sep 05 10:26:44 DKERP setroubleshoot: AnalyzeThread.run(): Cancel pending alarm Sep 05 10:26:44 DKERP setroubleshoot: failed to retrieve rpm info for /sys/fs/cgroup/memory/memory.limit_in_bytes Sep 05 10:26:44 DKERP setroubleshoot: SELinux is preventing /usr/bin/mongod from getattr access on the file /sys/fs/cgroup/memory/memory.limit_in_bytes. For complete SELinux mes> Sep 05 10:26:44 DKERP setroubleshoot: SELinux is preventing /usr/bin/mongod from getattr access on the file /sys/fs/cgroup/memory/memory.limit_in_bytes. ***** Plugin catchall (100. confidence) suggests ************************** If you believe that mongod should be allowed getattr access on the memory.limit_in_bytes file by default. Then you should report this as a bug. You can generate a local policy module to allow this access. Do allow this access for now by executing: # ausearch -c 'mongod' --raw | audit2allow -M my-mongod # semodule -X 300 -i my-mongod.pp Sep 05 10:26:44 DKERP setroubleshoot: AnalyzeThread.run(): Set alarm timeout to 10 Can you please suggest how can I get mongod to run?
Ashar (527 rep)
Sep 5, 2022, 07:00 AM • Last activity: Sep 5, 2022, 11:37 AM
0 votes
1 answers
838 views
start-stop-daemon can't stop the daemon "No $daemon found running; none killed."
Trying to stop the transmission daemon on debian 11 gives me: start-stop-daemon --stop --chuid debian-transmission --exec /usr/bin/transmission-daemon -- --config-dir /var/lib/transmission-daemon/info No /usr/bin/transmission-daemon found running; none killed. But I'm pretty sure that's not the case...
Trying to stop the transmission daemon on debian 11 gives me: start-stop-daemon --stop --chuid debian-transmission --exec /usr/bin/transmission-daemon -- --config-dir /var/lib/transmission-daemon/info No /usr/bin/transmission-daemon found running; none killed. But I'm pretty sure that's not the case: root@91c79f82a860:/var/www/html# ps -ef | grep transmission debian-+ 1347 1 0 19:02 ? 00:00:00 /usr/bin/transmission-daemon --config-dir /var/lib/transmission-daemon/info **System information:** root@91c79f82a860:/var/www/html# dpkg -s transmission-daemon | grep Version Version: 3.00-1 root@91c79f82a860:/var/www/html# lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 11 (bullseye) Also, I'm doing this inside a docker container, php:8.1.8-apache. I extracted the start-stop-daemon CMD from the /etc/init.d/transmission-daemon.
vytaux (53 rep)
Aug 20, 2022, 07:10 PM • Last activity: Aug 23, 2022, 04:19 PM
2 votes
1 answers
2525 views
How can I cancel (abort) a shutdown when I see "A stop job is running..."?
I entered `sudo shutdown -h now` to shutdown my computer. Then, the "A stop job is running..." message appeared. I wanted to abort my shutdown and go back to appropriately closing the running programs... but I couldn't find a way to cancel my shutdown so all I could do was wait for the shutdown to c...
I entered sudo shutdown -h now to shutdown my computer. Then, the "A stop job is running..." message appeared. I wanted to abort my shutdown and go back to appropriately closing the running programs... but I couldn't find a way to cancel my shutdown so all I could do was wait for the shutdown to continue. Most of the guidance I find online are focused on forcing immediate shutdown whereas I want to **stop** the shutdown. Is it possible to abort the shutdown in this situation? *Environment: Debian, XFCE, xfce4-terminal, Bash*
dungarian (455 rep)
Jun 14, 2022, 04:10 PM • Last activity: Jun 14, 2022, 04:35 PM
0 votes
1 answers
683 views
Service takes more than a minute to close
I have a Linux based device which is running certain services on boot-up, however one of them seems to be taking over a minute to close as I run `adb shell shutdown -h now` command. Is there a way to tell what's causing this extra delay while the service is being shut down? The following is a part o...
I have a Linux based device which is running certain services on boot-up, however one of them seems to be taking over a minute to close as I run adb shell shutdown -h now command. Is there a way to tell what's causing this extra delay while the service is being shut down? The following is a part of the daemon file that gets invoked as service are getting shut down...
start-stop-daemon -K -n /usr/bin/service
I see the following in logs
A stop job is running for service (1min 8s / 1min 15s)
A stop job is running for service (1min 11s / 1min 15s)
A stop job is running for service (1min 15s / 1min 51s)
...
xyf (141 rep)
May 18, 2022, 09:59 PM • Last activity: May 19, 2022, 03:09 AM
2 votes
1 answers
8012 views
systemctl stop service doesn't work
I wrote this service in/etc/systemd/system called `nexusiq.service`: ``` [Unit] Description=Nexus IQ Service After=network.target [Service] Type=simple ExecStart=/etc/init.d/nexus-iq-server start ExecStop=/etc/init.d/nexus-iq-server stop User=root Restart=on-abort TimeoutSec=600 [Install] WantedBy=m...
I wrote this service in/etc/systemd/system called nexusiq.service:
[Unit]
Description=Nexus IQ Service
After=network.target

[Service]
Type=simple
ExecStart=/etc/init.d/nexus-iq-server start
ExecStop=/etc/init.d/nexus-iq-server stop
User=root
Restart=on-abort
TimeoutSec=600

[Install]
WantedBy=multi-user.target
The script nexus-iq-server in /etc/init.d that is invoked in ExecStart and ExecStop, depending on whether I give "start" or "stop" as argument does the following:
NEXUS_IQ_SERVER_HOME=/apps/nexus/nexus-iq-server
VERSION=1.127.0-01
JAVA_OPTIONS="-Xmx4096m -XX:+UseG1GC"
RUN_AS_USER=root

do_start()
{
    cd $NEXUS_IQ_SERVER_HOME
    su -m $RUN_AS_USER --command "java $JAVA_OPTIONS -jar nexus-iq-server-$VERSION.jar server config.yml 2> stderr.log &"
    echo "Started nexus-iq-server"
}

do_console()
{
    cd $NEXUS_IQ_SERVER_HOME
    su -m $RUN_AS_USER --command "java $JAVA_OPTIONS -jar nexus-iq-server-$VERSION.jar server config.yml 2> stderr.log"
}

do_stop()
{
    pid=ps aux | grep nexus-iq-server | grep '.jar server' | grep -vE '(stop|grep)' | awk '{print $2}'
    kill $pid
    echo "Killed nexus-iq-server - PID $pid"
}

do_usage()
{
    echo "Usage: nexus-iq-server [console|start|stop]"
}

case $1 in
    console)
        do_console
        ;;
    start)
        do_start
        ;;
    stop)
        do_stop
        ;;
    *)
        do_usage
        ;;
esac
I have enabled the service. When I run the command: systemctl start nexusiq the command assigned to ExecStart is correctly invoked. But, if i run the command systemctl stop nexusiq, the command assigned to ExecStop is not invoked. Furthermore, if I run the command systemctl status nexusiq, looks like the service is inactive:
● nexusiq.service - Nexus IQ Service
   Loaded: loaded (/etc/systemd/system/nexusiq.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Wed 2021-11-17 12:56:03 CET; 16s ago
  Process: 14806 ExecStop=/etc/init.d/nexus-iq-server stop (code=exited, status=0/SUCCESS)
  Process: 14800 ExecStart=/etc/init.d/nexus-iq-server start (code=exited, status=0/SUCCESS)
 Main PID: 14800 (code=exited, status=0/SUCCESS)

Nov 17 12:56:03 nexusiq2 systemd: Started Nexus IQ Service.
Nov 17 12:56:03 nexusiq2 su: (to root) root on none
Nov 17 12:56:03 nexusiq2 nexus-iq-server: Started nexus-iq-server
Can anyone explain to me what is causing this, and how to fix it?
Nicola Auricchio (21 rep)
Nov 17, 2021, 11:58 AM • Last activity: Nov 20, 2021, 10:21 AM
2 votes
1 answers
369 views
Start and stop systemd units in the same order
How am I supposed to do this in systemd? start unit.A started unit.A start unit.B started unit.B stop unit.A stopped unit.A stop unit.B stopped unit.B --- I know `After=/Before=` will order units in reverse on start/stop like AB -> BA, but I need AB -> AB. My guess is, that I have to merge `unit.A`...
How am I supposed to do this in systemd? start unit.A started unit.A start unit.B started unit.B stop unit.A stopped unit.A stop unit.B stopped unit.B --- I know After=/Before= will order units in reverse on start/stop like AB -> BA, but I need AB -> AB. My guess is, that I have to merge unit.A with unit.B, something along the lines of *unit.A.service:* ExecStartPost=unit.A And handle stop ordering in ExecStopPost=. **EDIT:** It seemed that a combination of Upholds= and PropagatesStopTo= would probably give me what I want, or very close, but it turns out, those are added in systemd version 249, but I have to get it running on 241/247. I still have an academic interest in whether Upholds= and PropagatesStopTo= would have been the right call, had I access to systemd 249?
Zoltan K. (603 rep)
Sep 12, 2021, 10:36 AM • Last activity: Oct 7, 2021, 09:25 AM
6 votes
2 answers
28197 views
Running a Python script in Conda virtual environment as service
I recently wrote a Python program that is designed to communicate via SMPP SMS server. The issue I'm facing is that I don't know how to run a Python script as a service on my Cent OS server using Conda virtual environment. I'm using a lot of dependencies and choosing virtual environment over Conda i...
I recently wrote a Python program that is designed to communicate via SMPP SMS server. The issue I'm facing is that I don't know how to run a Python script as a service on my Cent OS server using Conda virtual environment. I'm using a lot of dependencies and choosing virtual environment over Conda is not an option. Is there any way I could run this script as a service? Also is there a way to write console methods to start this script using the following? service fooService start
David Swan (71 rep)
Jul 29, 2016, 10:43 PM • Last activity: Mar 25, 2021, 06:46 AM
8 votes
4 answers
52980 views
Running init.d script produces "start-stop-daemon: not found"
I try to start monit using: /etc/init.d/monit start I then get the error: [....] Starting daemon monitor: monit/etc/init.d/monit: 124: /etc/init.d/monit: start-stop-daemon: not found failed! Typing which start-stop-daemon shows /sbin/start-stop-daemon ls -al in /sbin shows -rwxr-xr-x 1 root root 267...
I try to start monit using: /etc/init.d/monit start I then get the error: [....] Starting daemon monitor: monit/etc/init.d/monit: 124: /etc/init.d/monit: start-stop-daemon: not found failed! Typing which start-stop-daemon shows /sbin/start-stop-daemon ls -al in /sbin shows -rwxr-xr-x 1 root root 26740 Jan 21 12:18 start-stop-daemon edit: adding script #!/bin/sh ### BEGIN INIT INFO # Provides: monit # Required-Start: $remote_fs # Required-Stop: $remote_fs # Should-Start: $all # Should-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: service and resource monitoring daemon # Description: monit is a utility for managing and monitoring # processes, programs, files, directories and filesystems # on a Unix system. Monit conducts automatic maintenance # and repair and can execute meaningful causal actions # in error situations. ### END INIT INFO set -e . /lib/lsb/init-functions DAEMON=/usr/bin/monit CONFIG="/etc/monit/monitrc" DELAY="/etc/monit/monit_delay" NAME=monit DESC="daemon monitor" MONIT_OPTS= PID="/var/run/$NAME.pid" # Check if DAEMON binary exist [ -f $DAEMON ] || exit 0 [ -f "/etc/default/$NAME" ] && . /etc/default/$NAME # For backward compatibility, handle startup variable: if [ -n "$startup" ] then if [ "$1" = "start" ] then printf "\tPlease, use START variable in /etc/default/monit\n" printf "\tto enable/disable $NAME startup.\n" fi if [ -z "$START" ] && [ "$startup" -eq 1 ] then START="yes" fi fi # For backward compatibility, handle CHECK_INTERVALS variable: if [ -n "$CHECK_INTERVALS" ] then if [ "$1" = "start" ] then printf "\tPlease, use MONIT_OPTS variable in /etc/default/monit\n" printf "\tto specify command line options for $NAME.\n" fi MONIT_OPTS="$MONIT_OPTS -d $CHECK_INTERVALS" fi MONIT_OPTS="-c $CONFIG $MONIT_OPTS" monit_not_configured () { if [ "$1" != "stop" ] then printf "\tplease configure $NAME and then edit /etc/default/$NAME\n" printf "\tand set the \"START\" variable to \"yes\" in order to allow\n" printf "\t$NAME to start\n" fi exit 0 } monit_check_config () { # Check for emtpy config. if [ "grep -s -v \"^#\" $CONFIG" = "" ] then echo "empty config, please edit $CONFIG." exit 0 fi } monit_check_perms () { # Check the permission on configfile. # The permission must not have more than -rwx------ (0700) permissions. # Skip checking, fix perms instead. /bin/chmod go-rwx $CONFIG } monit_delayed_monitoring () { if [ -f $DELAY ] then printf "Warning: Please, set start delay for $NAME in config file\n" printf " and delete $DELAY file.\n" if [ ! -x $DELAY ] then printf "Warning: A delayed start file exists ($DELAY)\n" printf " but it is not executable.\n" else $DELAY & fi fi } monit_checks () { # Check if START variable is set to "yes", if not we exit. if [ "$START" != "yes" ] then monit_not_configured $1 fi # Check for emtpy configfile monit_check_config # Check permissions of configfile monit_check_perms } case "$1" in start) log_daemon_msg "Starting $DESC" "$NAME" monit_checks $1 if start-stop-daemon --start --quiet --oknodo \ --pidfile $PID --exec $DAEMON \ -- $MONIT_OPTS then log_end_msg 0 else log_end_msg 1 fi monit_delayed_monitoring ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" if start-stop-daemon --retry TERM/5/KILL/5 --oknodo --stop --quiet \ --pidfile $PID --exec $DAEMON then log_end_msg 0 else log_end_msg 1 fi ;; reload) log_daemon_msg "Reloading $DESC configuration" "$NAME" if start-stop-daemon --stop --signal HUP --quiet \ --oknodo --pidfile $PID \ --exec $DAEMON -- $MONIT_OPTS then log_end_msg 0 else log_end_msg 1 fi ;; restart|force-reload) $0 stop $0 start ;; syntax) $DAEMON $MONIT_OPTS -t ;; status) status_of_proc -p $PID $DAEMON $NAME ;; *) log_action_msg "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload|syntax|status}" ;; esac exit 0
JonS (81 rep)
Jan 21, 2015, 08:11 PM • Last activity: Nov 4, 2020, 12:05 PM
0 votes
0 answers
335 views
Systemctl daemon only works when verbose is enabled
I have a daemon in init.d which except for the name and description has exactly the same structure as the standard ubuntu [skeleton file](https://gist.github.com/mrowe/8b617a8b12a6248d48b8). When I try to run said daemon using ``` sudo /etc/init.d/mydaemon start ``` I get an error that starting the...
I have a daemon in init.d which except for the name and description has exactly the same structure as the standard ubuntu [skeleton file](https://gist.github.com/mrowe/8b617a8b12a6248d48b8) . When I try to run said daemon using
sudo /etc/init.d/mydaemon start
I get an error that starting the daemon failed with the message
Control process exited, code=exited, status=1/FAILURE
which isn't very helpful as code 1 doesn't really mean anything as far as I can tell. While debugging this, at one point I decided to change the verbose variable at /lib/init/vars.sh from no to yes, just to provoke some output and upon doing that, the daemon runs flawlessly. Yet when I change verbose back to no, I get the same errors as previously. Have any of you ever encountered somehthing like this and now what may be causing it? Also, the daemon code is in c++ and is the following (although i don't think it's neccesarily relevant for this):
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;

#define DAEMON_NAME "mydaemon"

void process(){

    syslog (LOG_NOTICE, "Writing to log from Daemon");
}

int main(int argc, char *argv[]) {

    //Set our Logging Mask and open the Log
    setlogmask(LOG_UPTO(LOG_NOTICE));
    openlog(DAEMON_NAME, LOG_CONS | LOG_NDELAY | LOG_PERROR | LOG_PID, LOG_USER);

    pid_t pid, sid;

   //Fork the Parent Process
    pid = fork();

    if (pid  0) { exit(EXIT_SUCCESS); }

    //Change File Mask
    umask(0);

    //Create a new Signature Id for our child
    sid = setsid();
    if (sid =0; x--)
    {
        close (x);
    }

    //----------------
    //Main Process
    //----------------
    while(true){
        process();    //Run our Process
        sleep(30); //Sleep for 30 seconds
        break;    
    }

    //Close the log
    closelog ();
    return 0;
}
user404496
Apr 15, 2020, 11:31 AM
4 votes
2 answers
18539 views
Set daemon to start at boot with systemd
I'm writing a daemon to manage my Java app on a headless **Ubuntu 16.04** box using jsvc and [this (probably pre-systemd) tutorial][1], and got as far as running `update-rc.d mydaemon enable`, receiving the error `update-rc.d: error: mydaemon Default-Start contains no runlevels, aborting` Having Goo...
I'm writing a daemon to manage my Java app on a headless **Ubuntu 16.04** box using jsvc and this (probably pre-systemd) tutorial , and got as far as running update-rc.d mydaemon enable, receiving the error update-rc.d: error: mydaemon Default-Start contains no runlevels, aborting Having Googled around a bit this appears to have something to do with the (fairly?) recent move to systemd, which I have confirmed is running with pidof systemd. How do I achieve the same starting-at-boot behaviour as update-rc.d (and more importantly *stopping* the service via /etc/init.d/mydaemon stop rather than just killing the process as the Java app needs to clean up). And are systemd and update-rc.d different systems, or does systemd just change how the latter works?
Luke M (153 rep)
Sep 3, 2016, 01:46 PM • Last activity: Mar 26, 2020, 01:03 PM
0 votes
1 answers
2052 views
pgadmin4 service won't start
I am not a sysadmin but since I can't afford paying one, I need to do the job myself ;-) I have a lxc container running on a proxmox4 box. proxmox4$ uname -a Linux dbd 4.4.98-2-pve #1 SMP PVE 4.4.98-101 (Mon, 18 Dec 2017 13:36:02 +0100) x86_64 GNU/Linux In the container, I installed PGAdmin4 as a se...
I am not a sysadmin but since I can't afford paying one, I need to do the job myself ;-) I have a lxc container running on a proxmox4 box. proxmox4$ uname -a Linux dbd 4.4.98-2-pve #1 SMP PVE 4.4.98-101 (Mon, 18 Dec 2017 13:36:02 +0100) x86_64 GNU/Linux In the container, I installed PGAdmin4 as a service. Installation is in my home directory. I also installed systemd as it wasn't there by default. I created a /lib/systemd/system/pgadmin4.service. PGAdmin won't start and here is the output of : $ sudo systemctl -l status pgadmin4 pgadmin4.service - Pgadmin4 Service Loaded: loaded (/lib/systemd/system/pgadmin4.service; enabled) Active: failed (Result: exit-code) since Tue 2018-01-30 13:35:49 UTC; 9s ago Process: 673 ExecStart=/home/ballama/pgadmin/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py (code=exited, status=226/NAMESPACE) Main PID: 673 (code=exited, status=226/NAMESPACE) Jan 30 13:35:49 dbd systemd: Started Pgadmin4 Service. Jan 30 13:35:49 dbd systemd: pgadmin4.service: main process exited, code=exited, status=226/NAMESPACE Jan 30 13:35:49 dbd systemd: Unit pgadmin4.service entered failed state. I am stuck and do not know how to solve this. Any help appreciated of course. Marc
Marc BALLAT (1 rep)
Jan 30, 2018, 05:54 PM • Last activity: Feb 27, 2020, 07:02 PM
1 votes
1 answers
3881 views
AIX and daemon service
I see that the daemon service is started and stopped via the commands: startsrc and stopsrc on group/subsystem. I have init.d script and I want to make it daemon service in AIX. From these commands I think I have to put the init.d script into a group and then the starting and stopping of the service...
I see that the daemon service is started and stopped via the commands: startsrc and stopsrc on group/subsystem. I have init.d script and I want to make it daemon service in AIX. From these commands I think I have to put the init.d script into a group and then the starting and stopping of the service will be done by the commands "startsrc" and "stopsrc" executed on the group/subsystem.But how can I put the init.d script into a group/subsystem?
Gordon (21 rep)
Jan 22, 2020, 11:16 AM • Last activity: Jan 22, 2020, 06:10 PM
2 votes
0 answers
2264 views
Unable to kill / terminate programs if another terminal window opened
I’m running a program on raspberry pi which opens few other python programs for a certain amount of time and then closes them. What is happening: - if I’m running the main program from e.g. Python 3 IDE or Thonny Python or other IDEs, everything works fine, it opens and closes all programs as expect...
I’m running a program on raspberry pi which opens few other python programs for a certain amount of time and then closes them. What is happening: - if I’m running the main program from e.g. Python 3 IDE or Thonny Python or other IDEs, everything works fine, it opens and closes all programs as expected. - if I’m running the main program from e.g. Python 3 IDE or Thonny Python or other IDEs, but I have some other terminal window opened (not even running anything, just opened and sitting idle), it will open all the programs, but it’s unable to close them down after. - if I’m running the main program in terminal window, it will open all the programs, but it is unable to close them down after. code e.g. while True: proc = subprocess.Popen(['lxterminal', '-e', ' test_aa.py']) proc_bb = subprocess.Popen(['lxterminal', '-e', 'test_bb.py']) time.sleep(5) proc.terminate() proc_bb.kill() time.sleep(200) Another example while True: print("opening") proc = subprocess.Popen(['lxterminal', '-e', ' test_aa.py']) c = proc.pid print(c) time.sleep(3) os.kill(c, signal.SIGTERM) time.sleep(700) works if no other terminal window opened manually, To start the programs I also tried different variations of Popen and os.system, they work every time fine. To kill/terminate I’ve tried: os.system, os.kill(pid, signal.SIGTERM), os.kill(pid, signal.SIGINT) etc. kill with -9 PID, subprocess.Popen and then kill() or terminate() **UPDATE 1** As per my question above, I think I can partially answer it, but at the same time this will raise more questions. Taking under consideration this code: while True: print("opening") proc = subprocess.Popen(['lxterminal', '-e', ' test_aa.py']) c = proc.pid print(c) time.sleep(3) os.kill(c, signal.SIGTERM) time.sleep(700) using ps aux I found that ['lxterminal'] And ['test_aa.py'] Are running with different pid numbers. So c = proc.pid is giving me pid for ['test_aa.py'] and this probably could explain why I can’t terminate ['lxterminal'] Am I correct in saying that? What would be other options to start a python program in another terminal window, but to make sure they have same pid numbers? **UPDATE 2** I'm running the new terminal window under one pid number – so that’s sorted. I’m also using code to make sure there is no zombie process running: stdout, stderr = proc.communicate() proc.wait() and it does work, no zombie process running after. But unfortunately same story again, if I open some terminal window and run my program it won’t terminate terminal started by my program. I tried on two different raspberry pi. Same thing. Why if I have another terminal window opened, it suddenly fails to close my programs? **FINAL UPDATE** I’m partially answering my own question I still don’t understand why if I had some terminal window opened my program wasn't terminating other programs, but I found a way around it. Instead of lxterminal, I am using uxterm #uterm can also be used My code looks like this now: proc = subprocess.Popen([‘uxterm’, ‘-e’, ‘test_aa.py’], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, preexec_fn=os.setsid) it work perfect. I can have other programs running in terminal windows, I can reboot and using .sh files bring all programs back to life again. This is exactly what I was looking for :-) Thanks everyone for help.
samson77 (21 rep)
Jan 6, 2020, 11:41 PM • Last activity: Jan 13, 2020, 09:46 PM
Showing page 1 of 20 total questions