LinuxQuestions.org
Visit Jeremy's Blog.
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 06-10-2013, 09:49 PM   #1
Andyd513
LQ Newbie
 
Registered: Jun 2013
Posts: 3

Rep: Reputation: Disabled
Init.d script not accepting = sign in command arguments


Hey guys,

Long time lurker first time poster. I searched and searched for this one but either my google & search skills are failing me or I'm brain dead today. I figure someone must have run into this one before, seems pretty simple.

So I'm in the midst of setting up a lumberjack, logstash, elastisearch setup and am trying to write a quick and dirty init.d script for lumberjack since I need it to start on boot for a lot of systems.

I've tried a lot of ways to initiate the process, but even this simple shell script:

#!/bin/bash
HOSTFIELD="xxxxx"
HOST="xxxxx"
PORT="5001"
SSLPATH="/xxx/.ssh/logstash/logstash.pub"
FILE="/***/***/*****/server.log"


LBJBIN="/opt/lumberjack/bin/lumberjack"
$LBJBIN --field sourcehost=${HOSTFIELD} --host $HOST --port $PORT --ssl-ca-path $SSLPATH $FILE


This is the resulting command executed though:

29962 pts/0 SNl+ 0:00 /opt/lumberjack/bin/lumberjack --field sourcehost xxxxx --host xxxxx --port 5001 --ssl-ca-path ******/.ssh/logstash/logstash.pub /***/***/*****/server.log


Notice the = sign in --field sourcehost=xxxxxx disappears, and shows as a space.

If I try to escape it with a \, the space remains. If I place two equals signs, I get a space and an equals sign. This is driving me nuts. Has anyone run into this before?

If I execute this from the command line it takes the quotes properly.
 
Old 06-10-2013, 10:38 PM   #2
derekpock
Member
 
Registered: Apr 2012
Location: USA
Distribution: Elementary OS Luna
Posts: 83

Rep: Reputation: 4
Not a solution but an attempt to help. Try placing semi-colons at the end of each line.

Wow...I completely missed you last line there...sorry....ok....

Try placing the = in quotes. "="

Last edited by derekpock; 06-10-2013 at 10:40 PM.
 
Old 06-11-2013, 09:28 AM   #3
Andyd513
LQ Newbie
 
Registered: Jun 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for the reply.

This is what I tried:

--field sourcehost"="${HOSTFIELD}

Result:

--field sourcehost xxxxxxx

(same )
 
Old 06-11-2013, 10:22 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,713

Rep: Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279
Works fine here.

Are you sure you don't have an odd definition causing the extra substitutions?

You might try "sh -vx <script>" to get a dump of what is going on.
 
Old 06-11-2013, 01:24 PM   #5
Andyd513
LQ Newbie
 
Registered: Jun 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Here's a result again of executing a simple script that's just trying to execute the process.

#!/bin/bash
./lumberjack.sh --field sourcehost=<sourcehost> --host <host> --port 5001 --ssl-ca-path <path>/.ssh/logstash/logstash.pub /<path>/server.log
+ ./lumberjack.sh --field sourcehost=<sourcehost> --host <host> --port 5001 --ssl-ca-path <path>/.ssh/logstash/logstash.pub /<path>/server.log
2013-06-11T13:20:51.684-0400 Watching 1 files, setting open file limit to 103
2013-06-11T13:20:51.684-0400 Watching 1 files, setting memory usage limit to 1048576 bytes

Everything looks good there.. but a process listing shows:

4052 pts/1 SNl+ 0:00 ./lumberjack --field sourcehost <sourcehost> --host <host> --port 5001 --ssl-ca-path /<path>/.ssh/logstash/logstash.pub /<path>/server.log
 
Old 06-11-2013, 05:04 PM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,713

Rep: Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279
That would be AFTER the process is started - and could have modified the parameter list during parsing.
 
  


Reply


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
Problem with analyzing command line arguments: bash shell script newbiecolonopenparens Linux - Newbie 7 05-24-2012 09:29 PM
Taking command arguments from serial port into shell script warwick Linux - Software 6 06-13-2011 02:29 AM
cd command doesn't work in script with more than two arguments in quotes vipinchauhan LinuxQuestions.org Member Intro 5 05-02-2009 12:20 AM
Shell script - Pass command options with equal sign fabdog Linux - Newbie 5 02-13-2009 07:32 AM
How can I pipe output of a command into arguments of a script HGeneAnthony Linux - General 3 12-26-2007 07:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:43 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