简体   繁体   中英

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?

After Kali linux boots up, I have tried editing rc.local, rc.init and rc file.

Adding

service apache start

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. 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

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

Ie do the following:

Place the text:

#!/bin/bash
sudo service apache start

inside /etc/init.d/apaStart (a new file created by you)

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)

I won't suggest this method but it'll work with your situation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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