bash Kali Linux 中自动启动脚本的其他方法?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48558468/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Other ways for auto-start script in Kali Linux?
提问by LewlSauce
So I'm basically wanting to get a script to run on system boot. It's basically an SSH callback. I've tried a few ways that I've gotten to work in the past on other distributions, but having a little bit of difficulty here.
所以我基本上想要一个脚本来在系统启动时运行。它基本上是一个 SSH 回调。我已经尝试了一些过去在其他发行版上工作的方法,但在这里遇到了一些困难。
First thing I've tried was adding the /path/to/script.rb
to /etc/rc.local. However, this file does not exist on the latest version of Kali Linux. I tried to create it and replicate my old Ubuntu rc.local file, but it didn't run on system startup.
我尝试的第一件事是将/path/to/script.rb
/etc/rc.local添加到。但是,最新版本的 Kali Linux 上不存在此文件。我尝试创建它并复制我的旧 Ubuntu rc.local 文件,但它没有在系统启动时运行。
Next thing I tried was creating an executable bash script in /etc/init.d/, following the update-rc.d script.sh defaults
and making the file executable. Restarted and nothing. If I run the script manually, it works. I tried to redirect the output to a file in the tmp folder, but it doesn't appear that there are any errors from what I'm understanding.
我尝试的下一件事是在 /etc/init.d/ 中创建一个可执行的 bash 脚本,update-rc.d script.sh defaults
然后使该文件可执行。重新启动,什么都没有。如果我手动运行脚本,它会起作用。我试图将输出重定向到 tmp 文件夹中的一个文件,但我所理解的似乎没有任何错误。
Are there any other ways to get an auto run script started other than these two methods? Seem to be the most common way to get this working, but it's just not doing it for me.
除了这两种方法之外,还有其他方法可以启动自动运行脚本吗?似乎是让这个工作最常见的方法,但它不适合我。
回答by An0n
Add script to
将脚本添加到
/etc/init.d
Run command:
运行命令:
chmod 755 /etc/init.d/script
Run command:
运行命令:
update-rc.d script enable