0

We need to lump together Apache2 Server and xsp2 server(or mod-mono-server server) in the configuration for the auto start sample shown below when the PC reboots.

Quoting from the article, https://askubuntu.com/questions/9382/how-can-i-configure-a-service-to-run-at-startup

"sudo update-rc.d minidlna defaults
This should add the service to the automatic startup system. But if you get:

System start/stop links for /etc/init.d/minidlna already exist.
Do the command

sudo update-rc.d minidlna enable"

How could I adapt the above sample so that Apache2 Server and xsp2 server are lumped together during the automatic startup procedure?

I was thinking of launching Apache2 first directly followed by launching xsp2 next. Is this possible to do with Ubuntu 16.04 or is there a better way?

Any help is greatly appreciated.

  • 1
    That linked article is 6 years old. Ubuntu has move on since then and now uses systemd to start services. apache will have the required files to start it automatically at boot, but you may have to write your own for mono-xsp2. – garethTheRed Jun 12 '16 at 21:40
  • @garethTheRed, Thank you for your excellent comment. What is the and path of apache's required files to start it automatically at boot? What do I have to write for mono-xsp2? Why do we use mono-xsp2 instead of xsp2? – Frank Jun 12 '16 at 22:11
  • @garethTheRed, Thank you for your excellent comment. What is the name and filepath for apache's required files to start it automatically at boot? What do I have to write for mono-xsp2? Finally, why do we have to use mono-xsp2 instead of xsp2? – Frank Jun 12 '16 at 22:28
  • 1
    For Apache it's systemctl enable apache2. You could (probably) copy the apache .service file and change the ExecStart for xsp2. I suggested mono-xsp2 as the XSP package after a very quick Google - feel free to ignore that :-) – garethTheRed Jun 13 '16 at 6:36
  • @garethTheRed, Here are some helpful reference URLs for this question: [Can I use xsp2 instead of apache with mod_mono as my regular web server application? [stackoverflow.com/questions/8158665/mono-and-ihttphandler][1] May I use apache2 to xsp2 on a standalone basis to serve ASP.NET content to browser users? – Frank Jun 13 '16 at 7:16
1

I wish to thank @garethTheRed for suggesting to use systemd instead of update-rc.d

The URL Writing basic systemd service files contains this answer.

Step 1: I created this file (note location) which essentially fires a bash process with an extended argument. You could fire your own command which could be different from bash.

[root@y500-fedora ~]# cat /usr/lib/systemd/system/foo.service 
[Unit]
Description=foo

[Service]
ExecStart=/bin/bash -c "while true; do /bin/inotifywait -qq --event close_write /sys/class/backlight/acpi_video0/brightness; su myusername -c '/bin/xbacklight -display :0 -set $(cat /sys/class/backlight/acpi_video0/brightness)'; done"

[Install]
WantedBy=graphical.target
Step 2:

systemctl enable foo
(similarly you can disable it)

(optional) Step 3: It should start automatically at next reboot into graphical mode (run level 5) but if you want to start it right away:

# systemctl start foo
# systemctl status foo # optional, just to verify
  • @garethTheRed, Thank you for the nice edit. – Frank Jun 13 '16 at 7:17

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.