How to fix Ubuntu 14.04 Apache PID not match? - linux

Lately, every time I restart the server, Ubuntu always gives me a warning message of Apache 2 PID not match. I have to manually kill it and restart Apache 2.
I then follow the guide to check if the PID file in /var/run/apache2 is same as the one in /etc/init.d/apache2/apache2.conf, but I found that there's no file in /var/run/apache2.
I also try to follow the steps in this website
Which says "Check if pid file path set in /etc/init.d/apache2/apache2.conf equals APACHE_PID_FILE variable exported in /etc/init.d/apache2/envvars." But there's no such directory of /etc/init.d/apache2/envvars
How can I fix this? Thanks!

Related

Error autostarting Linux service after reboot if condition is met: "Path in condition not absolute, ignoring"

I have a service named MyService that needs to auto-start a NodeJS process only if "Configured!" can be found inside of a configuration file. The MyService.service file contains the following in the Service section:
ExecStart=/usr/bin/sh -c "if grep -q 'Configured!' /path/to/configuration/file.conf; then /usr/bin/node /path/to/node/process.js; fi"
However, the problem is that the NodeJS process does not auto-start. In fact, when I look in journalctl, I see the following error message:
Path in condition not absolute, ignoring: "/path/to/configuration/file.conf"
How can I please change ExecStart to successfully auto-start the NodeJS process when the condition has been met? This is very puzzling because when I run the ExecStart command on the command line, it works correctly. Also, the path to the configuration file is an absolute path.
(Also, please note that since this machine is running an old version of systemd, I am not able to use ExecCondition.)
The issue is with double quotes in :
"/path/to/configuration/file.conf"
which makes systemd think it's not a absolute path.

No lock file found in /usr/local/nagios/var/nagios.lock

I followed the instructions at this link which I found here on EE...http://nagios.sourceforge.net/docs/3_0/quickstart-fedora.html
Well after trying to stop nagios with command service nagios stop and after that to see its status with service nagios status the following message appears: "No lock file found in /usr/local/nagios/var/nagios.lock". How do I resolve it.
Thanks.
This is not a bug. "No lock file found in /usr/local/nagios/var/nagios.lock" means that it isn't running.
If you run an echo $? directly after service nagios status while it isn't running, you'll notice that the exit code is 3.
3 is the correct value return code for that status as documented in the Linux Standard Base.
Some Sources:
https://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/iniscrptact.html
http://ftp.novell.hu/pub/mirrors/ftp.novell.com/forge/library/SUSE%20Package%20Conventions/spc_init_scripts.html
Just run:
/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
UPDATE:
The error: "No lock file found in /usr/local/nagios/var/nagios.lock" simply means that nagios is not running.
Running the command above simply starts the nagios daemon and points it to a specific config file. The advantage to running this command manually over systemd is that when you run "service nagios start" this typically calls the /etc/rc.d/init.d/nagios script which contains a line with parametrized environment variables:
$NagiosBin -d $NagiosCfgFile
Because every system is different, not specifying either the bin nor config directories could lead to nagios breaking (stopping) when it tries to start using the default installation directory paths

How can I let jprofiler find the PID of running tomcat server?

I extracted the jprofiler tar.gz on a remote linux server. After trying the bin/jpenable command I got:
'No unprofiled JVMs found.'
So I went looking for the PID of the running tomcat server and I think I found it in the var/run directory. A file called tomcat7.pid
So I went back to the source folder of jprofiler and tried: jpenable --pid=[the id that was in the pid file I mentioned earlier]
as specified on page 277 of the following document: http://resources.ej-technologies.com/jprofiler/help/doc/help.pdf and got:
No JVM with PID [the pid] found that is running as the same user.
So since the user I'm logged in as is ubuntu I tried to log in with user tomcat7 but even after giving up the correct password (which we changed with sudo) I remain logged in as ubuntu (as confirmed by whoami command) and the problem above persists.
How do I get this jprofiler to find the jvm I need it to??
Fixed.
We run tomcat as a service so we needed to add agentpath on startup of the jvm. Added the following to /usr/share/tomcat7/bin/setenv.sh :
-agentpath:/opt/jprofiler/jprofiler7/bin/linux-x64/libjprofilerti.so=port={port we want}
Then enabled that port on aws.

Where should I put the "down" file to prevent Chef from starting

I am running Open Source Chef 11 Server and a dozen or so Linux and SmartOs servers running chef-client. At one point I created a file on one of my linux servers with the filename of "down" in a specific directory and that prevented the chef-client from running, even after reboot. I have since deleted this file and I cannot remember which directory I had put that file in. I can no longer find any documentation that this existed or works. Did I imagine this?
I realize the point of Chef is to have chef-client running at all times but sometimes it is useful to disable the chef-client while experimenting with the server configuration.
I believe this "down" file might be related to runit.
I think I found it.
If I create the file in /etc/sv/chef-client
# touch /etc/sv/chef-client/down
then run
# sv status chef-client
I get back
down: chef-client: 85480s; run: log: (pid 8000) 93131s
If I remove the down file I get back
down: chef-client: 85539s, normally up; run: log: (pid 8000) 93190s

Can't find mod_authz_svn.so while restarting apache2

I tried to install and setup a svn server using apache2,
I followed instructions on internet but while i tried to restart apache2 it shows the following error:
apache2: Syntax error on line 204 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/authz_svn.load: Cannot load /usr/lib/apache2/modules/mod_authz_svn.so into server: libsvn_repos-1.so.0: cannot open shared object file: No such file or directory
Action 'configtest' failed.
i checked the path but the file do exist,im not sure what is happening.
need some help thanks~
Based on your pathes, it looks like you are playing debian or ubuntu config. if I remember well, this module *mod_authz_svn.so* is available with libapache2-svn, so you need first to apt-get this module as root, and then to enable it (being in the directory /etc/apache2, *a2enmod my_module*) and reload your apache config (or restart apache).
The other way around is to load the module as a DSO. Then it's a different process.

Resources