简体   繁体   English

linux deploy,kali,在启动后启动应用程序服务

[英]linux deploy, kali, start an app service after its boots up

Hi there does anybody knows how to make an apache2 service to run at startup? 嗨,有人知道如何在启动时运行apache2服务吗?

After Kali linux boots up, I have tried editing rc.local, rc.init and rc file. Kali linux启动后,我尝试编辑rc.local,rc.init和rc文件。

Adding 新增中

service apache start 服务apache启动

command I have also made bash script, giving its permissions to run it with chmod +x b.sh - placed in bin folder for ability to run in anywhere in command line. 命令我还制作了bash脚本,并授予其使用chmod + x b.sh运行它的权限-放置在bin文件夹中,以便能够在命令行中的任何位置运行。 I am able to run it in terminal, it does what I need. 我可以在终端中运行它,它可以满足我的需求。 But can't get it running on start up. 但是无法在启动时运行它。

Also I tried: 我也尝试过:

update-rc.d mystartup.sh defaults 100 update-rc.d mystartup.sh默认为100

still no success. 仍然没有成功。 Any ideas? 有任何想法吗? Thanks. 谢谢。

Place your script inside init /etc/init.d/ , then place a link to it inside /etc/rc5.d/ (be sure to get your accurate run-level)... Start the second link with the string S71 like S71apastart 将脚本放在init /etc/init.d/中 ,然后将其链接放在/etc/rc5.d/中 (确保获得准确的运行级别)...从第二个链接开始,使用字符串S71 S71apastart

Ie do the following: 即执行以下操作:

Place the text: 放置文字:

#!/bin/bash
sudo service apache start

inside /etc/init.d/apaStart (a new file created by you) /etc/init.d/apaStart内部(由您创建的新文件)

Then 然后

sudo chmod +x /etc/init.d/apaStart

sudo ln -s /etc/init.d/tomcat /etc/rc5.d/S71apaStart (change rc5.d to rc3.d if needed depending on your runlevel) sudo ln -s /etc/init.d/tomcat /etc/rc5.d/S71apaStart (如果需要,请根据运行级别将rc5.d更改为rc3.d)

I won't suggest this method but it'll work with your situation. 我不建议使用这种方法,但是可以根据您的情况使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM