Stop neo4j from command line on Linux - neo4j

I am trying to shutdown a neo4j database which is run from an Appimage on my desktop. The official docs specify using: systemctl stop neo4j https://neo4j.com/docs/operations-manual/3.4/installation/linux/systemd/
This results in the following error:
Failed to stop neo4j.service: Unit neo4j.service not loaded.
How do I shutdown neo4j running from an Appimage from the command line?

pkill -TERM neo4j-desktop
Using the system to exit neo4j is less elegant than I had hoped (but appears to work without issue).
Linux: close a program with command line (not kill it)

Related

How to fix erlang application restarting with upstart?

I have an erlang application (OTP 21) that runs as an upstart service. When I try to restart application with sudo initctl restart my_service I got an error:
Protocol 'inet_tcp': the name my_service#localhost seems to be in use by another Erlang node
and application don't started again.
Based on dates in logs I decided that upstart try to start application a few milliseconds before it actually stopped. How can I fix this?

(using WSL ubuntu app) system has not been booted with system as init system (PID 1). Can't operate [duplicate]

This question already has an answer here:
Enable Systemd in WSL 2
(1 answer)
Closed 2 months ago.
I'm a very first user of Ubuntu. I failed to install Ubuntu in wmware ,so I installed Ubuntu application in Microsoft app store and everything was quite all right.
But when I insert shutdown or halt command to power off my ubuntu I kept getting 'system has not been booted with system as init system (PID 1). Can't operate' error message.
I tried to using docker following with this link (https://blog.jayway.com/2017/04/19/running-docker-on-bash-on-windows/) but I failed after going to Number 2 process many times. I'm not sure my failure is because of installing docker toll box instead of normal one. (my computer is just windows 10. not a windows pro)
I think I have to try other thing. If you don't mind me asking, how can I slove this problem?
(and one more. If I just click 'X' button at the top of right side, is it different with shutting down Ubuntu using 'halt' or 'shutdown' command?
Thank you
I found this useful: https://linuxhandbook.com/system-has-not-been-booted-with-systemd/
In my case
# start docker using systemctl
sudo systemctl docker start
# returns:
#
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
The basic advice is:
# check if your system is using `systemd` or `sysvinit`
ps -p 1 -o comm=
If the command doesn't return systemd, and in my case, Ubuntu-20.04 on WSL, the command returned init, then use the command pattern
# start services using sysvinit
service docker start
This works for me.
Based on this: https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/
systemd is now available in WSL Version 0.67.6 or higher.
To enable:
Open a command prompt:
# CHOOSE option A or B:
# A. check your version and ensure it is 0.67.6 or higher
wsl.exe --version
# B. run WSL update if the version is low
wsl.exe --update
Open a WSL prompt:
sudo nano /etc/wsl.conf
Add this to wsl.conf and save the file:
[boot]
systemd=true
Go back to the command prompt:
# warning: this will kill any shells/processes you have running!
wsl.exe --shutdown
First of all, Ubuntu installed via MS Store is using WSL (Windows Subsystem for Linux) Technology. It simply means there is no virtualization, Windows and Linux kernels are living side by side (the Linux kernel is not fully implemented yet).
So if you are trying to "shut down your Ubuntu", you would turn off the whole computer just like the Windows does. But in this case, WSL doesn't apparently have rights to do that.
In other words, you can look at your Ubuntu bash window just like any other terminal, like e.g. CMD or PowerShell.
When you start a program in the WSL (Ubuntu), you can see it also in Windows Task Manager - that's just a proof, that there is no virtualization.
Regarding docker:
If I'm not mistaken Windows 10 Home doesn't provide Hyper-V virtualization. It means you'll have to use a different one e.g. by using VirtualBox. In order to make it work, I can recommend you to follow this tutorial and especially for VirtualBox please check this answer here
Hope it helps :)

Neo4j Start Error: /var/run/neo4j/neo4j.pid: No such file or directory

After upgrading from Neo4j 3.0 to 3.1 (and subsequently 3.2), I get the following error after running sudo neo4j start:
/usr/share/neo4j/bin/neo4j: line 411: /var/run/neo4j/neo4j.pid: No such file or directory
Nonetheless, Neo4j is actually running after running this command.. However, I cannot then stop Neo4j afterwards with sudo neo4j stop, as there is no PID.
How can I fix this?
Notes:
I upgraded using sudo apt upgrade
It is possible to get around this issue by doing a sudo mkdir /var/run/neo4j beforehand, but was hoping there might be a more effective solution.
When using the installation package you should not start/stop with the neo4j script, but use the installed service. Depending on your Ubuntu version that is
sudo service neo4j {start|stop|restart}
or
sudo systemctl {start|stop|restart} neo4j
Check http://neo4j.com/docs/operations-manual/current/installation/linux/debian/ and http://neo4j.com/docs/operations-manual/current/installation/linux/systemd/ for more information.
Hope this helps,
Tom
P.S. Note that starting/stopping without using the service may have started Neo4j with the wrong user (root instead of neo4j) and files may therefore have the wrong ownership now !

Jenkins service starts then stops on Windows 7

I downloaded the native windows Jenkins package and installed it. On installation, it starts as a service in and shows in Task Manager, and also on going to the url localhost:8080. But then it stops. Here is what I get in my jenkins.out.log:
Running from: C:\Program Files (x86)\Jenkins\jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
Jenkins home directory: C:\Program Files (x86)\Jenkins found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
Any ideas what could be causing this? I've checked throuh netstat that no other process is using the port 8080.
I found that the java.exe process was hung and keeping Jenkins from starting. I killed the java process and then jenkins service started up just fine.
Use process explorer.
It's possible to start jenkins via the command line using java -jar jenkins.war, however, because the process is started via the command line it will also end when that command window is closed.
A better way would be to start the service via jenkins.exe but you would have to remind doing that at every startup.
Ultimately we have settled with a batch script with the following content:
cd "C:\Program Files (x86)\Jenkins"
start javaw -jar jenkins.war >> outputFile.txt
adding start before calling javaw makes sure that the command window is not attached to the process started, making it possible to safely close down the command line.
Using >> outputFile.txt writes the command window feedback in a text file, making debugging a whole lot easier when Jenkins ever breaks down!
Save it in a batch script, schedule it with windows Task Scheduler to run at startup et voilà: properly set up Jenkins service.
Only make sure it doesn't stop at log-off.
I switched back to version 1.535 and now it works.
After my win vm system rebooted, the jenkins 1.625.2 service would just keep stopping.
It solved it by:
Kill java processes. Found some old java running dll's.
Uninstall old version of jdk1.6 that was there.
Cleaning java temp. files dir.
Then I was able to restart the service w/o problem.
if java.exe not visible in process
1.netstat -a -o -n find out the PID of your port
2.tasklist /FI “PID eq PID″
3.taskkill /F /PID 2600 kill the process

Webrick will not stop or restart

I was running Linux Mint 13 prior to now, and just switched to Fedora 17. Since I have made the switch, I can no longer stop Webrick. I use Jetbrains Rubymine, and starting the server works fine, but as soon as I hit stop, or restart, it somehow detatches from the processes and I cannot use that port again until I reboot my computer. My first thoughts were that it was a problem with Rubymine, but when I start the server in a console, it does the exact same thing. I hit ctrl-c to stop it (and it appears to do so), but as soon as I go to start the server again on that port, it fails because of duplicate address in use.
I have this error on Mint (opposite to you, as I see) - Ubuntu machine always exits fine by CTRL+C. Solution without restarting your machine: kill Webrick process. Search for a PID of detached server process via ps aux | grep rails command and then kill it via kill -9 <PID>
In one line you can run this in your project dir:
kill -9 `cat tmp/pids/server.pid`
(You can also set this command as an alias in your .bash_profile, to use more easily)
Or is there no Webrick process to kill, whatsoever?

Resources