3

Every time I start or restart my Ubuntu 16, Xampp doesn't start I have start manually by sudo /opt/lampp/lampp start. Making script like sudo nano /etc/init.d/lampp doesn't work command update-rc.d lampp defaults gives me error:

insserv: warning: script 'K01lampp' missing LSB tags and overrides
insserv: warning: script 'lampp' missing LSB tags and overrides
insserv: fopen(.depend.stop): Permission denied

The script File contains the below lines:

[#!/bin/bash

/opt/lampp/lampp start]

Any solution?

1
    • First move that particular script to /etc/init.d/ Directory

for example

#! /bin/sh
# /etc/init.d/lampp
#

# Some things that run always
touch /var/lock/lampp

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting script lampp "
    echo "Could do more here"
    ;;
  stop)
    echo "Stopping script lampp"
    echo "Could do more here"
    ;;
  *)
    echo "Usage: /etc/init.d/lampp {start|stop}"
    exit 1
    ;;
esac

exit 0

Once you've saved your file into the correct location make sure that it's executable by running "chmod 755 /etc/init.d/lampp".

Then you need to add the appropriate symbolic links to cause the script to be executed when the system goes down, or comes up.

*it's this way

root@root:~# update-rc.d lampp defaults

2.Do it using GUI

  • STARTUP APPLICATIONenter image description here
| improve this answer | |
  • I tried making a symbolic link but gives me error: ln: failed to create symbolic link '/opt/lampp/lampp': File exists – Adarsh Hiwrale Jan 11 '17 at 5:12
  • The file which i have made is in /etc/init.d/lampp and the original file is in /opt/lampp/lampp . – Adarsh Hiwrale Jan 11 '17 at 5:13
  • /opt/lampp/lampp this the main file which i use to start xampp sudo /opt/lampp/lampp start – Adarsh Hiwrale Jan 11 '17 at 12:46
  • Try my answer below. That should be much more easy. – Muhammad bin Yusrat Mar 7 '17 at 11:17
  • Thank you for the answer which has helped me, Akhil Varma. I have expanded your script a bit more to fully support the service command fully. Please refer to my answer below for my sharing. Thank you. – Lye Heng Foo Aug 2 '19 at 12:12
4

My solution is rather simple.

Simply open terminal and write

sudo gedit /etc/rc.local

And then add these 2 lines just before the last line

cd /opt/lampp/
sudo ./lampp start

And that's it. Simply save and restart the computer. Please note that these lines should be above the last line that says exit 0

I hope it helps someone else.

| improve this answer | |
1

Thank you for the answer which has helped me, Akhil Varma.

Based on the earlier from Akhil Varma, I would like to share a modified version for /etc/init.d/lampp to support service or systemctl command fully. Please make sure the command used and file created is done in root.

#! /bin/sh
# /etc/init.d/lampp
#

# Some things that run always touch /var/lock/lampp

# Carry out specific functions when asked to by the system case "$1" in   start)
    echo "Starting script lampp "
    /opt/lampp/lampp start
    /opt/lampp/lampp startftp
    ;;   status)
    echo "Status of script lampp"
    /opt/lampp/lampp status
    if test -f /opt/lampp/logs/httpd.pid 
    then
      exit 0
    else
      exit 3
    fi
    ;;   stop)
    echo "Stopping script lampp"
    /opt/lampp/lampp stop
    ;;   *)
    echo "Usage: /etc/init.d/lampp {start|stop|status}"
    exit 1
    ;; esac

exit 0

This is assuming the installation directory for LAMPP/XAMPP is at /opt/lampp. Change accordingly if your LAMPP/XAMPP installation directory is different.

Make sure the /etc/init.d/lampp is executable by:

chmod 755 /etc/init.d/lampp

To enable auto-start for LAMPP/XAMPP service:

update-rc.d lampp defaults

You can now use the following service command as follows, and it will report correctly:

service lampp status
service --status-all

or

systemctl status lampp

To start/stop the lampp manually:

service lampp start
service lampp stop

or

systemctl start lampp
systemctl stop lampp

Hope it helps.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.