Home > ubuntu > execute a command during boot as root

execute a command during boot as root

Problem
During the boot process you want to execute a command as root. For instance, I needed a symbolic link in /run, but /run is a virtual file system and its content is lost when you switch the machine off.

Solution
Edit the file /etc/rc.local . Example:

#!/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.

# this link is required by a project of mine
ln -s /media /run/media

exit 0

This tip is from here.

Advertisements
Categories: ubuntu Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: