nohup help
I need help adding a nohup command in this command line:
su - rhx12 -c "/rhythx/rhythx/bin start /rhythx/rhyth" When I execute the script using root on the command line it works fine. But, when I reboot the server the process doesn't start. This script will go into the etc/init.d and rc2.d directory. #!/bin/bash case $1 in start) su - rhx12 -c "/rhythx/rhythx/bin start /rhythx/rhythx" ;; stop) su - rhx12 -c "/rhythx/rhythx/bin stop /rhythx/rhythx" ;; *) echo "should be command stop or start" ;; esac |
First, please don't double-post. Choose only one forum that you think best matches your topic. I'm responding to this one because it's a scripting question.
Second, please use [code][/code] tags around your code, to preserve formatting and to improve readability. Code:
case $i in |
Yes thats correct, it should be $1.
I am at home and I don't have access to the work network so I entered the script from memory. |
Please edit your post to put the code in a Code block, as suggested above. It will make your post easier to read, & that will get you more, better, & faster help.
|
Thanks I was able to fix this.
|
2 of us, one Senior Member & one Moderator, have nicely asked you to edit your post which started this thread.
|
I fixed the code using the edit link.
The link you provided did not help find the solution. But, its a useful link. regards |
Quote:
The command wouldn't run because it is an interactive command expecting a password entered, which won't happen when running as a startup script. Be careful with automated scripts such as cron scripts for example. For cron scripts you aren't attached to a terminal, so you can't get input from stdin. There is no stdout, so either redirect output to /dev/null or a log file. Also, nohup isn't used for scripts already running in the background. Look at the skeleton file in /etc/init.d/. It is a model of what a script in init.d should look like. You left out the headers that inserv and chkconfig use. In rc2.d/ you should have a properly named link to the script in init.d/. Don't put scripts in their. You might want to read the man pages for insserv, chkconfig and init.d. (note: some distro's don't use chkconfig.) |
All times are GMT -5. The time now is 10:23 AM. |