Linux Lite Forums
How to Run a Command at Every Bootup? - Printable Version

+- Linux Lite Forums (https://www.freecinema2022.gq/forums)
+-- Forum: Software - Support (https://www.freecinema2022.gq/forums/forumdisplay.php?fid=5)
+--- Forum: Other (https://www.freecinema2022.gq/forums/forumdisplay.php?fid=20)
+--- Thread: How to Run a Command at Every Bootup? (/showthread.php?tid=246)



How to Run a Command at Every Bootup? - leegold - 04-18-2014

Somewhat of a general question, using LinuxLite and want to have a command executed when ever the system boots. It's not a "root command", does not need sudo when I do it from the terminal. From my memory since I'm not at that computer the command is:

djmount  /home/linuxlite/av

it just connects to a Upnp server and gets the media. Be nice if it did that at boot. How to do this automatically at boot?

Thanks.




Re: How to Run a Command at Every Bootup? - N4RPS - 04-19-2014

Hello!

Unless someone suggests a better way, you could add it to your /etc/rc.local file. Of course, you'll have to edit this file as root, using nano or the text editor.

In a terminal window [CTRL-ALT-T],

Code:
sudo nano /etc/rc.local

should allow you to execute that command at startup...

73 DE N4RPS
Rob



Re: How to Run a Command at Every Bootup? - leegold - 04-21-2014

Many thanks.


Re: How to Run a Command at Every Bootup? - warhawk8080 - 06-09-2018

Just make sure it looks like this

Code:
#!/bin/sh -e
#
# rc.local - executed at the end of each multiuser runlevel
#
# Make sure that the script will "exit 0" on success or any other
# value on error.

all the stuff you wanna run up there...yadda yadda

exit 0
https://unix.stackexchange.com/questions/49626/purpose-and-typical-usage-of-etc-rc-local

Or it might hang