如何在Windows中通过.bat脚本停止/启动Neo4j服务器 [英] How to stop/start Neo4j server via .bat script in windows

查看:1142
本文介绍了如何在Windows中通过.bat脚本停止/启动Neo4j服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux中运行neo4j服务器时,我们有几个命令-启动,停止,重新启动等-通过命令行对其进行控制.

When running the neo4j server in Linux, we have several commands - start, stop, restart, etc - to control it via the command line.

在Windows中,手册只是说:

In windows, the manual simply says:

用法-Windows Neo4j.bat

Usage - Windows Neo4j.bat

双击Neo4j.bat脚本将在控制台中启动服务器.要退出,只需在控制台窗口中按Control-C.

Double-clicking on the Neo4j.bat script will start the server in a console. To quit, just press control-C in the console window.

但是,如果我通过从自己的.bat文件中执行neo4j.bat来启动它而又没有控制台窗口,该如何停止它?

对于上下文:我正在使用一个非托管扩展,因此我需要重建jar,将其移至plugins目录中,并在每次进行更改时重新启动服务器.手动执行此操作很麻烦,所以(当我在Linux上工作时)我让Intellij重建了工件并执行了.sh脚本,将生成的jar移至/plugins并重新启动了neo4j.

For context: I'm working on an unmanaged extension, so I need to rebuild my jar, move it into the plugins directory and restart the server each time I make a change. It'd be a pain in the ass to do this manually, so (when when I was working in Linux) I had Intellij rebuild the artifact and execute a .sh script that moved the resultant jar into /plugins and restarted neo4j.

'/path/to/neo4j/bin/neo4j' stop
rm /path/to/neo4j/plugins/api.jar
mv /project/path/artifacts/graphapi.jar /path/to/neo4j/plugins/api.jar 
'/path/to/neo4j' start

我如何在Windows中使用.bat文件进行同样的操作?

How do I do the same in windows using a .bat file?

我已经尝试过:

del "C:/path/to/neo/plugins/api.jar
move "C:/project/path/artifacts/api.jar" "C:/path/to/neo/plugins/api.jar"
C:/neo/bin/Neo4j.bat 

希望再次调用Neo4j.bat将停止当前进程并启动另一个进程,但是显然不是这种情况.

hoping that simply calling Neo4j.bat again would stop the current process and start another, but apparently that's not the case.

推荐答案

如果您使用的是Windows,则可以通过执行以下命令来停止Neo4j服务器:neo4j.bat stop

If you're on Windows you can stop Neo4j server by executing: neo4j.bat stop

对于那些可能不熟悉命令行的人,让我详细介绍一下:

Let me show it in details for those who might be new to the command line:

  1. 我们需要知道Neo4j的位置.如果您记得在哪里提取它-很好,则可以跳过此步骤.对于其他用户:打开任务管理器,然后找到Commons Daemon Service Runner 此处的外观单击鼠标,打开属性",然后查找其位置"路径.在文件管理器中找到此路径.我们正在寻找带有neo4j.bat文件的bin文件夹.

  1. We need to know where Neo4j is located. If you remember where did you extract it - good, you can skip this step. For others: open Task Manager and look for Commons Daemon Service Runner here how it looks like right mouse click, open Properties and look for its Location path. Find this path in your file manager. We are looking for bin folder with neo4j.bat file.

打开命令行并输入cd,然后粘贴您的路径,按Enter键.您应该使用neo4j.bat文件跳到该文件夹​​.

Open command line and write cd and then paste your path, hit enter. You should jump to that folder with neo4j.bat file.

停止服务器:键入neo4j.bat stop并执行.它将征求您的许可.

Stop the server: Type neo4j.bat stop and execute. It will ask for your permission .

在那之后,您可以仔细检查并输入'neo4j.bat status',以确保它没有停止.

after that, you can double check and type 'neo4j.bat status` t be sure it's stopped.

P.S. Windows重新启动后,neo4j服务器将自动重新启动.如果您不希望这样做(它消耗了多达500Mb的内存,至少在我的数据库〜64k记录中),则应卸载该服务. 在该目录中执行neo4j.bat uninstall-service.

P.S. After Windows reboot neo4j server will be automatically restarted. If you don't want this (it consumes up to 500Mb of memory, at least in my DB ~64k records) you should uninstall the service. Execute neo4j.bat uninstall-service in that directory.

干杯!

这篇关于如何在Windows中通过.bat脚本停止/启动Neo4j服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆