Am I missing something when it comes to /etc/rc.local?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Am I missing something when it comes to /etc/rc.local?
My understanding is that if I put a command in /etc/rc.local, it should run at boot. However take a look at my /etc/rc.local and look at the output of ps aux straight afrer boot and you will see that hellanzb.py is not running
Code:
[root:~#] cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
/usr/bin/hellanzb.py -D
touch /var/lock/subsys/local
Code:
[root:~#] ls /usr/bin/hellanzb.py
/usr/bin/hellanzb.py
I've even tried moving hella to below the line beginning with touch and it still doesn't load.
During the boot sequence, if I press Alt-D, I can see right at the end that there is a message that pops up. Where can I look under /var/log to find out what that message is?
first make sure that /etc/rc.local is really able to run the file. add this inside the file
Code:
exec >/home/user/log
echo "trying to start /home/user/helladaemon"
[ -x /home/user/helladaemon ] && echo "/home/user/helladaemon seems to be not executable in this environment but lets try"
( exec /home/user/helladaemon ; ) &
exec >/dev/stdout
then check /home/user/log
Last edited by konsolebox; 03-14-2008 at 01:13 AM.
[root:~#] cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
exec >/home/user/log
echo "trying to start /home/user/helladaemon"
[ -x /home/user/helladaemon ] && echo "/home/user/helladaemon seems to be not executable in this environment but lets try"
( exec /home/user/helladaemon ; ) &
exec >/dev/stdout
Perhaps you need a disown command after you start the process so it won't terminate when the rc.local script terminates.
Without a disown, script termination automatically sends a "kill" signal to any of its children. Note that, unless you use an argument, the disown command should be the next command that the script runs since, by default, it "disowns" the last prior executed command.
Last edited by PTrenholme; 03-14-2008 at 12:00 PM.
Jongi
are u setting 777 i mean are u giving the executable permission ?
it needs to begin with S --> inorder to start
and then the process number -- > 97 for example | inorder to initiate the process with the priority as a number.
Jongi
are u setting 777 i mean are u giving the executable permission ?
it needs to begin with S --> inorder to start
and then the process number -- > 97 for example | inorder to initiate the process with the priority as a number.
S97filename | make sure its 7xx
Wouldn't that advice only apply if the Python program was in /etc/rc.d//init.d and being started as a service? The question was "How to run the script from /etc/rc/rc.local, although starting it as a service is not a bad idea.
If the OP wants to set it up as a service, a look at the scripts in /etc/rc.d/init.d should make the general process clear, and creating a link to the service script from /etc/rd.d/rc.5 in the format suggested above is relatively straight forward.
Note: The use of /etc/rc.d/ rather than /etc is, I believe, distribution specific, so the actual location of your service initiation scripts my differ from the location I specified. But they shouldn't be too hard to find.
You should simply find the way to start your /etc/rc.d/rc.local. Check your other /etc/rc.d/* files and find clues on how they are started. Perhaps changing the execution permissions or pointing a link to the file in a runtime directory will do the trick.
Jongi
are u setting 777 i mean are u giving the executable permission ?
it needs to begin with S --> inorder to start
and then the process number -- > 97 for example | inorder to initiate the process with the priority as a number.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.