LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 10-28-2013, 07:39 AM   #1
senbon
LQ Newbie
 
Registered: Oct 2013
Posts: 19

Rep: Reputation: Disabled
Sartup Script SUSE


Hi,


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 referred to this post: http://www.linuxquestions.org/questi...sartup-423154/

Which did not work, the command i entered in /etc/init.d/boot.local.was: elogd -p80 -c /usr/local/elog/elogd.cfg -D

Which works fine manually, but not in the startup script, any advice would greatly be appreciated.

Kind rgds,
 
Old 10-28-2013, 11:00 AM   #2
senbon
LQ Newbie
 
Registered: Oct 2013
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by senbon View Post
Hi,


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 referred to this post: http://www.linuxquestions.org/questi...sartup-423154/

Which did not work, the command i entered in /etc/init.d/boot.local.was: elogd -p80 -c /usr/local/elog/elogd.cfg -D

Which works fine manually, but not in the startup script, any advice would greatly be appreciated.

Kind rgds,
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.
 
Old 10-28-2013, 11:31 AM   #3
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Quote:
Originally Posted by senbon View Post
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 11:45 AM.
 
Old 10-29-2013, 06:18 AM   #4
senbon
LQ Newbie
 
Registered: Oct 2013
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
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?

Thanks thus so far.
 
Old 10-29-2013, 09:32 AM   #5
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
What does your boot.local file look like?
 
Old 10-29-2013, 10:10 AM   #6
senbon
LQ Newbie
 
Registered: Oct 2013
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
What does your boot.local file look like?
Hi,

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
 
Old 10-29-2013, 11:03 AM   #7
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Where is the elogd binary? Maybe it's not in the PATH, you should try using the absolute path to it in the startup script.
 
Old 10-29-2013, 01:14 PM   #8
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,817

Rep: Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408
what version of suse is this ?
you do not say

start up changed with opensuse 12
it no longer is using the old int system v
they moved to system D

so the whole start up process changed
 
Old 10-29-2013, 01:47 PM   #9
DavidMcCann
Senior Member
 
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 4,158

Rep: Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223Reputation: 1223
If you're using systemd, have a look at this
http://freedesktop.org/wiki/Software/systemd/
and in particular
http://0pointer.de/blog/projects/sys...-admins-3.html
 
Old 10-30-2013, 09:34 AM   #10
senbon
LQ Newbie
 
Registered: Oct 2013
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
Where is the elogd binary? Maybe it's not in the PATH, you should try using the absolute path to it in the startup script.
Hi,

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.

Binary location:

SUSE:/usr/local/sbin # whereis elogd
elogd: /usr/local/sbin/elogd /usr/share/man/man8/elogd.8.gz

PS - I might reply a bit later than expected as I am moving homes.

Thank you.

---------- Post added 10-30-13 at 08:35 AM ----------

Quote:
Originally Posted by John VV View Post
what version of suse is this ?
you do not say

start up changed with opensuse 12
it no longer is using the old int system v
they moved to system D

so the whole start up process changed
Hi,

I am on suse linux enterprise server 11.

Thanks.
 
Old 10-30-2013, 09:36 AM   #11
senbon
LQ Newbie
 
Registered: Oct 2013
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by DavidMcCann View Post
Hi,

I am not a Linux admin, so not really too sure about what the link is showing me.

Thank you.
 
Old 10-30-2013, 10:02 AM   #12
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Quote:
Originally Posted by senbon View Post
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.
 
Old 10-30-2013, 01:00 PM   #13
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,817

Rep: Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408
"/usr/local/sbin" is a bit of an odd location
/usr/sbin is the standard location for root user ONLY programs

the "local" folder might NOT be in the system $PATH unless YOU put it in the system path

did you ? add that odd location to the system $PATH ?

to check compare the root and NORMAL user $PATH - they SHOULD be different
Code:
echo $PATH
--- then as root----
Code:
su -
/*--- type in the root password when asked ---*/
echo $PATH
 
  


Reply

Tags
script, suse


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sartup file in linux alam8080 Red Hat 2 05-12-2008 07:50 PM
Adding a script to Suse Linux sartup wkatzer Linux - Software 1 03-09-2006 10:04 AM
alsa sartup bcal Linux - Software 18 02-05-2006 04:46 PM
SuSE Q-Which script controls... cbjhawks Linux - Networking 0 04-24-2004 10:15 PM
How do I create a script in SUSE 8.2? byfaithalone Linux - Newbie 2 10-16-2003 12:32 PM


All times are GMT -5. The time now is 10:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration