Last 2 years, I am using runit to run any script automatically during booting. When I was using Ubuntu 14.04 in my server, I wasn’t having any issue. But in Ubuntu 16.04, an issue has been found. runit plays with upstart which was default in Ubuntu 14.04. But in Ubuntu 16.04, upstart has been replaced with systemd. So, runit isn’t working normally. But the issue can be fixed as follows:

  1. At first, we will install upstart. As upstart and systemd can’t work together, so system will be removed automatically. Play the command on terminal:
$ sudo apt-get install upstart-sysv
  1. Now runit can be installed by this command:
$ sudo apt-get install runit
  1. runit has been installed. Now we will configure it to run python3 /home/maateen/test.py during booting. Let’s make a folder for this:
$ mkdir /etc/sv/en_maateen
  1. In this folder, we have to create a run script:
$ nano /etc/sv/en_maateen/run

And have to write some code in it:

#!/bin/bash
python3 /home/maateen/test.py
  1. Let’s make it executable:
$ chmod +x /etc/sv/en_maateen/run
  1. The last thing is to make a symbolic link between runit folder and upstart folder:
$ ln -s /etc/sv/en_maateen /etc/service/en_maateen

That’s all. If you find any issue, let me know please.