LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to run shell script from rc.local (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-run-shell-script-from-rc-local-685678/)

Anshul Pathak 11-24-2008 01:23 AM

How to run shell script from rc.local
 
Hello,

Can anybody tell me, How to run shell script at boot time ?

Regards,
Anshul Pathak

billymayday 11-24-2008 01:27 AM

You've sort of answered your question in the title, so what's not working?

Anshul Pathak 11-24-2008 02:37 AM

Quote:

Originally Posted by billymayday (Post 3352473)
You've sort of answered your question in the title, so what's not working?

Hi,

Actually i have created a java layer and i want to run it on linux at boot time.I have also created the shell script to run that layer and now i want to know what to write in "rc.local" to run my script file at boot time.

Regards,
Anshul Pathak

rohit_k 11-24-2008 08:22 AM

Just add your lines in rc.local (in end ).
eg:
/complete/path/to/binary/my_program &

HTH.

salter 11-24-2008 11:18 AM

You can also install a script in /etc/init.d
The script should handle at least the start, stop and status input commands
Then use chkconfig -add <your-script> to set your script to be launched during booting, or just run
/etc/init.d/<your-script> start
This is how a lot of other services are being started

tredegar 11-24-2008 12:11 PM

Which user do you want this script to run as?
If you just put the /path/to/script into rc.local, it'll be run as root, with no GUI, and you are unlikely to see any error-reporting.
This may not be what you want.


All times are GMT -5. The time now is 10:56 AM.