Search Results

Search: Posts Made By: greavette
9,085
Posted By apmcd47
How about one of these two lines: [ -f...
How about one of these two lines:
[ -f /var/chef/cache/cookbooks/bootstrap_cookbooks_version_* ] && echo /var/chef/cache/cookbooks/bootstrap_cookbooks_version_* | sed 's/.*version_//'...
9,085
Posted By MadeInGermany
If you know the possible pathnames then you don't...
If you know the possible pathnames then you don't need find and grep.
if [ -f /var/chef/cache/cookbooks/bootstrap_cookbooks_version_green ]
then echo "green"
elif [ -f...
9,085
Posted By RudiC
Well, then, try TMP=$(find /where/so/ever...
Well, then, try
TMP=$(find /where/so/ever -iname "*bootstrap*"); case ${TMP##*_} in (green) echo "is green";; (red) echo "is red";; (*) echo "is missing";; esac


You could, of course, also use...
9,085
Posted By RudiC
Do the two file versions coexist, or is there one...
Do the two file versions coexist, or is there one single file max?
And, why a one liner? What be the benefit thereof?
2,371
Posted By Scrutinizer
Try this modification to your code: ...
Try this modification to your code:
INACTIVE_KERNELS=$(python -mplatform | grep -qvi red && echo "Not Red Hat Server" || rpm -qa | grep '^kernel-[0-9]' |grep -vE `uname -r` | paste -sd \; | grep ....
2,371
Posted By Scrutinizer
Appending this would test if the returned string...
Appending this would test if the returned string is empty, so you could try that:
| grep .


--
The return code of the earlier grep command is nixed by the successful paste command
2,371
Posted By Neo
From my perspective, I don't understand why you...
From my perspective, I don't understand why you do not do all the text processing and system call in python, since your command starts out with python.

python works just fine to process text, make...
8,809
Posted By jim mcnamara
Plus, bash creates a subprocess (different from...
Plus, bash creates a subprocess (different from ksh) on the right side of a pipe, meaning any changes to variables in the statement on the right are not returned to the parent. This changed with...
8,809
Posted By Chubler_XL
This is the crux of it I think. On the first...
This is the crux of it I think. On the first look at your code I was suspicious that the redirect of stderr on one of the commands was causing you to miss an error causing this. So some nice...
1,920
Posted By Chubler_XL
The ssh client exit codes seem to be vary a fair...
The ssh client exit codes seem to be vary a fair bit between different implementations.

It's unfortunate the the online manual appears to be incorrect or old on your target system. You could...
4,711
Posted By RudiC
How about the lsb_release -a command?
How about the

lsb_release -a
command?
1,920
Posted By Chubler_XL
From man ssh: EXIT STATUS ssh exits...
From man ssh:

EXIT STATUS
ssh exits with the exit status of the remote command or with 255 if an
error occurred.

so:
$ ssh non-existant-user@mymachine
non-existant-user@mymachine:...
4,711
Posted By Neo
Please do not use QUOTE tags for formatting CODE,...
Please do not use QUOTE tags for formatting CODE, sample input, output or error message. Only user CODE tags.
4,421
Posted By RudiC
Your commands won't work; you need at least e.g....
Your commands won't work; you need at least e.g. "command substitution".
Try
APP=$(application --version 2>/dev/null || echo "not installed") Be aware that not all applications / tools offer a...
2,636
Posted By Scrutinizer
If you append | paste -sd \; to the command then...
If you append | paste -sd \; to the command then you get them in semi-colon separated fields in one line..
2,636
Posted By Neo
Please provide the results of this command (into...
Please provide the results of this command (into code tags) in your reply:

rpm -qa | grep tail -35

... so everyone can see the input data you are working with.

Thanks.
5,034
Posted By RudiC
Thanks, MadeInGermany, for pointing that ssh -n...
Thanks, MadeInGermany, for pointing that ssh -n option out. Still, the commands are passed as such (no backtics ``!) to the remote server, so uname -r will be executed remotely.


The script was...
5,034
Posted By MadeInGermany
Attention: ssh -qn is ssh -q -n where -n...
Attention:
ssh -qn is ssh -q -n where -n inhibits reading from stdin - good for ssh -q -n remotehost remotecommand. But it must be ssh -q remotehost < file and ssh -q remotehost << heredoc and ...
5,034
Posted By RudiC
You could write a script (local or remote) and...
You could write a script (local or remote) and execute that, or use "here documents" like

IFS=$'\t' read FLAVOUR HOSTNAME IPADDRESS ACTIVE_KERNEL INACTIVE_KERNEL UPTIME <<- EOFREAD
$(ssh...
5,034
Posted By Neo
If it was me.... I would write a script on...
If it was me....

I would write a script on the server side to read all the vars you are interested in and store the vars in a JSON file where the filename contains the timestamp, or put the...
Showing results 1 to 20 of 20

 
All times are GMT -4. The time now is 04:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy