kali开机自启动jar包
时间: 2023-10-07 12:14:33 浏览: 204
要在Kali Linux上实现开机自启动JAR包,你可以按照以下步骤进行操作:
1. 首先,确保你已经安装了Java Development Kit(JDK)和相关的依赖。你可以使用以下命令来安装它们:
```
sudo apt-get install default-jdk
```
2. 将你的JAR包放置在一个适当的位置,比如 `/opt` 目录下。确保你的JAR包具有可执行权限。
3. 创建一个启动脚本。在终端中使用以下命令创建一个新的脚本文件:
```
sudo nano /etc/init.d/myapp
```
4. 在打开的文件中,输入以下内容(假设你的JAR包名称为`myapp.jar`):
```
#!/bin/bash
### BEGIN INIT INFO
# Provides: myapp
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start myapp at boot time
# Description: Enable service provided by myapp.
### END INIT INFO
# Change directory to the location of your JAR file
cd /opt
# Start your JAR file
java -jar myapp.jar
```
5. 保存并退出文件。然后运行以下命令将脚本设置为可执行:
```
sudo chmod +x /etc/init.d/myapp
```
6. 最后,使用以下命令将脚本添加到启动项中:
```
sudo update-rc.d myapp defaults
```
现在,你的JAR包应该会在Kali Linux启动时自动运行。请确保替换脚本中的`myapp.jar`为你实际的JAR包文件名。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [kali配置一些环境](https://blog.csdn.net/Qwertyuiop2016/article/details/118539851)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [linux 服务+开机自启动服务实现(systemctl & crontab)](https://blog.csdn.net/ResumeProject/article/details/127021641)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文