分页: 1 / 1

xampp如何开机自启动?

发表于 : 2017-07-20 7:44
gtiubvrd
我尝试的步骤如下,不起作用,mysql和apache都没有开机自启动,请指点。

1. 在/etc/init.d 目錄下建立lampp.sh 文件,然后添加以下内容:
#!/bin/bash
/opt/lampp/lampp startmysql
/opt/lampp/lampp startapache

2. chmod 755 /etc/init.d/lampp.sh

3. 编辑/etc/init.d/rc.local在最后一行加上:
sh /etc/init.d/lampp.sh

或者
exec /etc/init.d/lampp.sh

4. 重启ubuntu

Re: xampp如何开机自启动?

发表于 : 2017-07-20 8:49
qy117121
现在的Ubuntu不是都用systemd了么

Re: xampp如何开机自启动?

发表于 : 2017-07-20 12:09
poloshiao
https://www.reddit.com/r/archlinux/comm ... art_xampp/
這一篇 適用於 arch linux

要適用於 Ubuntu 可能需要稍微修改
詳細參閱
https://wiki.ubuntu.com/SystemdForUpsta ... md_service
Example Systemd service

以上 適用於 Ubuntu 16.04 及 以上版本

Re: xampp如何开机自启动?

发表于 : 2017-07-20 22:26
TeliuTe
我是加到cron里定时开启和关闭 viewtopic.php?p=3182499#p3182499

Re: xampp如何开机自启动?

发表于 : 2017-07-28 19:10
gtiubvrd
谢谢,已找到解决方案。

以下操作在Ubuntu16.04下可以工作:
如果你想只启动apache,可以:
在/etc/init.d/下创建一个名为lampp.sh的文件,内容如下:
#! /bin/sh
/opt/lampp/lampp startapache
然后执行:
sudo chmod 755 lampp.sh
sudo update-rc.d lampp.sh start 80 2 3 4 5 . stop 30 0 1 6 .
这样就达到目的了。