• 13

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

On GCE, I have 3 VMs and I can use ssh to access them from one of them.
I've installed Cassandra on them and configured PATH environment variable in ~/.bash_profile.


export CASSANDRA_HOME=/opt/apache-cassandra-3.11.1
export SPARK_HOME=/opt/spark-2.1.2-bin-hadoop2.7
export PATH

Running echo $PATH and getting /usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/nmj/.local/bin:/home/nmj/bin:/opt/apache-cassandra-3.11.1/bin:/opt/spark-2.1.2-bin-hadoop2.7/bin:/opt/spark-2.1.2-bin-hadoop2.7/sbin means it's correct.

But when running pssh -h hosts.txt -l nmj -i 'echo $PATH', I only got /usr/local/bin:/usr/bin.
$PATH looks incorrect here.

So I couldn't use pssh to execute ssh in parallel to start up cassandra, like pssh -h hosts.txt -l nmj -i cassandra, because of bash: cassandra: command not found.

How to configure $PATH correctly?

In my opinion, pssh will start a non-login shell. So it'll not load ~/.bash_profile file. Then when I defined these variables in ~/.bashrc file, it worked.

Your answer might be here Why does the $PATH of an ssh remote command differ from that of an interactive shell?

Basically, because you're running a command as an argument, you are not actually opening a shell, so the files are not loaded, and the PATH variable is loaded with those files.

What you could do is source these files before running the cassandra command, and it may work

  • 1
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags