Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
I refereed to an old post prior to posting, among researching the web.
I have read there are many ways to have a startup script, my requirements are simple, to start a service for an application, so i do not have to do it manually.
I refereed to an old post prior to posting, among researching the web.
I have read there are many ways to have a startup script, my requirements are simple, to start a service for an application, so i do not have to do it manually.
Simple script to start the service
---------------------------------- #!/home/scripts
#Purpose: To start the elog deamon and the service via port 80
elogd -p 80 -c /usr/local/elog/elogd.cfg -D
Error returned: -bash: ./elogd.sh: /home/scripts: bad interpreter: Permission denied
Permission set on file are chmod 755.
Maybe this is the reason why the start does not work, for some reason this does not work in a script.
Any advice is appreciated.
Thanks.
Your problem is in bold. When you start a script, the first line should read #!/path/to/interpreter
Usually this would be #!/bin/bash or #!/bin/tcsh, or any other interpretter. You set this path to an interpretter that does not exist (I'm assuming, since that would be a weird name for it), hence the "bad interpreter" response.
Last edited by suicidaleggroll; 10-28-2013 at 10:45 AM.
Your problem is in bold. When you start a script, the first line should read #!/path/to/interpreter
Usually this would be #!/bin/bash or #!/bin/tcsh, or any other interpretter. You set this path to an interpretter that does not exist (I'm assuming, since that would be a weird name for it), hence the "bad interpreter" response.
Hi,
Yes, this made the shell script work. But the same command in the init.d/boot.local file does not work. How can make this script run so when the server boots up, the service is started?
Please see below. I have commented out the command i want to use, as it was not working.
#! /bin/sh
#
# Copyright (c) 2002 SuSE Linux AG Nuernberg, Germany. All rights reserved.
#
# Author: Werner Fink <werner@suse.de>, 1996
# Burchard Steinbild, 1996
#
# /etc/init.d/boot.local
#
# script with local commands to be executed from init on system startup
#
# Here you should add things, that should happen directly after booting
# before we're going to the first run level.
#
# start elog deamon on port 80
# elogd -p 80 -c /usr/local/elog/elogd.cfg -D
I amended the code to give the path to the binary file:
cd /usr/local/sbin/
elogd -p 8080 -c /usr/local/elog/elogd.cfg -D
But it still doesn't work upon boot, however when run separately it works fine.
That doesn't change anything. You did not give the script the path to anything, you simply changed directories.
When you run a program, the shell does not care where you are, not one bit. It only cares about one of two things:
Did you provide the path to the executable - absolute or relative doesn't matter, as long as you provided a path.
1) If you did provide a path, does the executable exist where you said it did?
2) If you did not provide a path, does the executable exist in any of the directories specified by the PATH environment variable?
Notice how your pwd doesn't come into play here at all unless you provided a relative path to the executable, which you did not. Change you call from "elogd" to "/usr/local/sbin/elogd" to eliminate this from the list of possible problems.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.