Saturday, 30 March 2019

Execute any command/script at system startup in Ubuntu 18.04 (LTS)

Today, after installing Ubuntu 18.04 after a long use of lower version of Ubuntu, I got there is no rc.local file in etc directory. Actually this file is used to start any script at system startup.

So, what to do if it is not available in Ubuntu 18.04?

Just create a file by typing any of given command -

sudo nano /etc/rc.local

or

sudo gedit /etc/rc.local

or

sudo cat /etc/rc.local


and paste the following text in this file -


#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0



After saving this, make it executable by command -

chmod +x /etc/rc.local


Now you can paste your scripting script in this file.

No comments:

Post a Comment

Change image source dynamically on hyperlink

 Changing image source dynamically using JQuery. Here in this example I have created there hyperlink and stored all images in the same folde...