0% found this document useful (0 votes)
35 views

Automatically Execute Script at Linux Startup With Debian 9

This document provides instructions for automatically executing a script at startup on Debian 9. It describes adding the script to the /etc/rc.local file, making it executable, and testing that it runs correctly by restarting the rc.local service and rebooting the system.

Uploaded by

emyu este
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Automatically Execute Script at Linux Startup With Debian 9

This document provides instructions for automatically executing a script at startup on Debian 9. It describes adding the script to the /etc/rc.local file, making it executable, and testing that it runs correctly by restarting the rc.local service and rebooting the system.

Uploaded by

emyu este
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Automatically execute

script at Linux startup with


Debian 9 (Stretch)
 Assuming you want to run the script /root/run_this_at_startup.sh at startup, first make
sure it’s executable:
 $ sudo chmod +x /root/run_this_at_startup.sh

 Add script to file /etc/rc.local :


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

 # added by ADMIN to run fancy stuff at boot:

 /root/run_this_at_startup.sh || exit 1

 exit 0

 Make sure /etc/rc.local is executable:


 $ sudo chmod +x /etc/rc.local

 Test that your script gets executed if rc.local is started:


 $ sudo service rc.local restart

 Reboot to test if the script gets executed at startup.

You might also like