Barra de espaço
Barra de espaço

This tutorial presents a detailed procedure showing how to configure static IP address on a computer running Ubuntu linux.

YOUTUBE

In our channel you can view the video of this tutorial.(SOON)



TUTORIAL

Access the /etc/systemd/system directory and create a new startup file.

In our example, I will create a startup script to my firewall.

# cd /etc/systemd/system/
# vi firewall.service

 

Here is the content of my file:

# cd /etc/systemd/system/
[Unit]
Description=firewall
After=multi-user.target
[Service]
Type=simple
ExecStart=/etc/init.d/firewall start
User=root
WorkingDirectory=/etc/init.d
Restart=no
[Install]
WantedBy=multi-user.target


Your  startup script needs to have some comments on the top, here are the first lines of my firewall script /etc/init.d/firewall:

#!/bin/bash
### BEGIN INIT INFO
# Provides: firewall
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: My firewall script
# Description: Enable service provided by daemon.
### END INIT INFO

 

Change the service file permission and enable the service:

# chmod 755 firewall.service
# systemctl enable firewall.service
# systemctl daemon-reload

 

Start the service:

# systemctl start firewall.service


Verify if the service is up and running: 

# systemctl status firewall.service

 

Restart the computer to make sure everything will work correctly at boot time.

CONCLUSION

This tutorial did show how to create startup scripts on a computer running ubuntu 17.