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.
given that the /etc/rc.local process needs to terminate...
nohup <yourcommand> &
The below did not work
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.
touch /var/lock/subsys/local
nohup /usr/bin/hellanzb.py -D &
[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.
/sbin/modprobe snd-ca0106
touch /var/lock/subsys/local
python /usr/bin/hellanzb.py -D -c /usr/etc/hellanzb.conf
I can see just as the boot process finishes that there is some sort of message but it almost immediately starts loading the DM. Maybe if I booted up in init 3 I would be able to see it? Or does the screen clear and the login prompt then appears?
When you start /usr/bin/hellanzb.py from the command line (and presumably it works OK from the command line), which user are you running as? If it is yourself, then that is the problem, as commands in rc.local are run as the root user. Please try suing to yourself, then running the command, with a line like this at the end of rc.local
Code:
su - yourusername -c "cd /home/yourusername/ && /usr/bin/hellanzb.py" &
This is how I start a vncserver for my username when one of my boxes boots. It works nicely
doesn't matter whether i run it as root or a normal user. If the command is successfully run, it is in a daemonised state and thus a ps aux should pick it up as running.
The "10" in the sleep 10 is the number of seconds to "sleep," so you can increase it as needed.
From man sleep:
Code:
SLEEP(1) User Commands SLEEP(1)
NAME
sleep - delay for a specified amount of time
SYNOPSIS
sleep NUMBER[SUFFIX]...
sleep OPTION
DESCRIPTION
Pause for NUMBER seconds. SUFFIX may be ‘s’ for seconds (the default), ‘m’ for
minutes, ‘h’ for hours or ‘d’ for days. Unlike most implementations that require
NUMBER be an integer, here NUMBER may be an arbitrary floating point number.
Given two or more arguments, pause for the amount of time specified by the sum of
their values.
Yeah I kinda guessed that's what it does.And that has shed the first serious bit of light on the problem.
The following error is what presents itself
Code:
Please install notify-python or disable Hellanzb.LIBNOTIFY_NOTIFY.
I am suspecting that hellanzb is trying to run in init 3 where notify-python is not loaded. I am guessing this as when I am in a desktop manager, There is no problems with running it.
EDIT: My suspicion above was confirmed by running hellanzb.py -D in init 5 and 3 once the system had booted. And sure enough the same error pops up in init 3.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.