No access to Linux shell in an mrsdeploy remote session - r

I've logged into a Microsoft R Server using mrsdeploy::remoteLogin()
Next I start a remote session with mrsdeploy::remoteCommandLine()
If I try to use system("pwd") I get no response.
I'm guessing access to the shell is blocked - does anyone know where this is controlled?

We found the answer to this.
The remote session does have access to the shell. You need to use intern = TRUE to see the result.
For example system("pwd", intern = TRUE)

Related

SaltStack eauth error with pam retval = 7 (PAM_PERM_DENIED)

My salt-master is running as a non-root user "salt". When eauth is turned on, PAM return value is 7. It seems pam.auth access is denied by PAM to "salt" user.
https://github.com/saltstack/salt/issues/26091
Would anyone be kind enough to show me what I need to configure in PAM?
External authentication using PAM needs salt-master process to be run as root. You don't need anything to be configured (of course except external_authentication part in master configuration file). Installing PAM, making sure login script is present and running salt-master as root is enough.
Check here for further information.

communicate to a client/server application in R

Is it possible to communicate to a client/server application by calling the command System in R?
I use BaseX for storing xml databases and I want to call a Basex client from R by using the "system"command after have launching the basexserver manually
setwd("C:/Program Files/BaseX/bin/")
system("basexclient -U admin -P admin",wait = TRUE)
BaseX 8.1 [Client]
Try help to get more information.
The problem is that R can't communicate with the BaseX Client, and as consequence i get this error :
Child process not responding.R will terminate it.
I tried to change wait parameter to wait=FALSE and then execute a command BaseX but it seems that it can't communicate to the client also.
system("OPEN mydatabse",wait = FALSE)
object "mydatabse" not found
Any suggestions you can provide will be appreciated.
N.B : The same problem occurs with Java

Checklist When IBM WebSphere Application server is running up

I have an IBM WebSphere Application Server v8.5 (WAS) installed on Linux RedHat 6.
My question: how can I check on the following by command (if exist):
Is the application server running or not?
Is the web application that deployed on it running or not?
The database connectivity (using datasource) is connected successfully or not?
The easiest and quickest to check all these things is to use web administrative console available at http://yourHost:9060/ibm/console.
If you want to use command, then:
Is the application server running or not?
You can check that issuing serverStatus command (will check all servers):
%PROFILE_ROOT%/bin/serverStatus.sh -all
or for specific server:
%PROFILE_ROOT%/bin/serverStatus.sh serverName
the output will be something like:
C:\IBM\WebSphere\AppServer85\profiles\AppSrv02\bin>serverstatus server1
ADMU0116I: Tool information is being logged in file
C:\IBM\WebSphere\AppServer85\profiles\AppSrv02\logs\server1\serverSta
tus.log
ADMU0128I: Starting tool with the AppSrv02 profile
ADMU0500I: Retrieving server status for server1
ADMU0508I: The Application Server "server1" is STARTED
Is the web application that deployed on it running or not?
There is no direct command for this. You can use wsadmin script for that. A simple one could be like the one below, if it returns entry the application is running:
print AdminControl.completeObjectName('type=Application,name=myApplication,*')
For more details check this question How do I determine if an application is running using wsadmin?
The database connectivity (using datasource) is connected successfully or not?
There is no direct command for this. You can use wsadmin script for that also. Here is sample script:
ds = AdminConfig.getid('/DataSource:Default Datasource/')
AdminControl.testConnection(ds)
For more details check this page Testing data source connections using wsadmin scripting
The serverStatus.sh command is s..l..o..w.. If you want an answer today then there is a file in the logs folder with the process PID:
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/servername/servername.pid
That file contains the PID of the server process. If it is running:
ps -p pid
Then the server is up.
1. ps -ef | grep dmgr
2. ps -ef | grep <application name>
Also grep SystemOut.log for e-business and verify latest timestamp.
Log into admin console, browse to DataSource, display from all scopes, select your datasource and then click test. As long as the nodeagent is running and has been restarted at least once since the Datasource config and credentials were added, then this test should be fairly accurate.

cloudmonkey with crontab?

i have a Cloudstack 4.2.1 here and would like my VMs to boot from time and shutdown at a scheduled time.
Hence i was thinking if i could integrate Cloudmonkey with CronTab together.
Firstly by creating a Cloudmonkey Script or API call then using crontab to run it at a specific time.
However i have problems creating a Cloudmonkey script/API call...
i haved googled and found this link
http://dlafferty.blogspot.sg/2013/07/using-cloudmonkey-to-automate.html
and had a result of
apiresult=cloudmonkey api stop virtualmachine id="'e10bdf21-2d5c-4277-9d8d-791b82b9e3be'"
unfortunately when i entered this command, nothing happened. If anyone could have an alternative suggestion or rather my API call command is wrong, please correct me and help
Thank you.
CloudMonkey requires some setup before it works (e.g. setting your API key).
Check [1] for the documentation for CloudMoney and follow through the Usage section to setup your environment.
Once your setup is complete and you can interact with CloudStack via CloudMonkey, you should take into account that the VM ids might change, so before you issue a command for a VM, you should first find the correct id, by listing the VMs and picking the right one.
Also, if you run into trouble, post the relevant log from CLoudStack management server (typically in /var/log/cloudstack/management/management-server.log).
[1] - https://cwiki.apache.org/confluence/display/CLOUDSTACK/CloudStack+cloudmonkey+CLI
Edit: If you have a working connection via CloudMonkey to CloudStack, you need to configure CloudMonkey in the same way in your shell script. For instance when you configured CloudMonkey you probably set a host, a port and your api and secret keys. So for your scrip to work you need to provide the same configuration to CloudMonkey prior to issuing the commands. My best guess is to use the -c option and provide a config file to set all the relevant parameters (e.g. api an secret key). cloudmonkey -c CONFIG_FILE ....
Edit2: You don't actually need to re-configure cloudmonkey in your script because it will remember your config from the interactive session. I would still advise you to do it, because your script gets more reliable. I've just made an example script like this:
#! /bin/bash
result=$(cloudmonkey list users)
echo $result
Result:
> ./tmp.sh
count = 1 user: id = 678e3a24-082c-11e4-86de-acbdb2423647 account = admin accountid = 678dffe6-082c-11e4-86de-acbdb2423647 accounttype = 1 apikey = T6sDBIpytyJ4_PMgNXYi8YgjMtwTiiDjijbXNB1J78EAZq2foKhCoGKjgJnej5tMaHM0LUvejgTddkhVU63wdw created = 2014-07-10T16:19:13+0200 domain = ROOT domainid = 678dd7b4-082c-11e4-86de-acbdb2423647 email = admin#mailprovider.com firstname = Admin iscallerchilddomain = False isdefault = True lastname = User secretkey = dzOPRecI5vvEVK7Vie2D0tDsQGXunUnpIAczbXnPI3sfMwQ-upWL_bPOisEYg4C-nXi-ldQno2KVZbVR-5NmVw state = enabled username = admin
Maybe you forgot to echothe result?

Authenticating Service Accounts on Google Compute Engine with BigQuery, via R Studio Server

I'm looking to call BigQuery from R Studio, installed on a Google Compute Engine.
I have the bq python tool installed on the instance, and I was hoping to use its service accounts and system() to get R to call bq command line tool and so get the data.
However, I run into authentication problems, where it asks for a browser key. I'm pretty sure there is no need to get the key due to the service account, but I don't know how to construct the authetication from with R (it runs on RStudio, so will have multiple users)
I can get an authetication token like this:
library(RCurl)
library(RJSONIO)
metadata <- getURL('http://metadata/computeMetadata/v1beta1/instance/service-accounts/default/token')
tokendata <- fromJSON(metadata)
tokendata$$access_token
But how do I then use this to generate a .bigqueryrc token? Its the lack of this that triggers the authetication attempt.
This works ok:
system('/usr/local/bin/bq')
showing me bq is installed ok.
But when I try something like:
system('/usr/local/bin/bq ls')
I get this:
Welcome to BigQuery! This script will walk you through the process of initializing your .bigqueryrc configuration file.
First, we need to set up your credentials if they do not already exist.
******************************************************************
** No OAuth2 credentials found, beginning authorization process **
******************************************************************
Go to the following link in your browser:
https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fbigquery&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&client_id=XXXXXXXX.apps.googleusercontent.com&access_type=offline
Enter verification code: You have encountered a bug in the BigQuery CLI. Google engineers monitor and answer questions on Stack Overflow, with the tag google-bigquery: http://stackoverflow.com/questions/ask?tags=google-bigquery
etc.
Edit:
I have managed to get bq functioning from RStudio system() commands, by skipping the authetication by logging in to the terminal as the user using RStudio, autheticating there by signing in via the browser, then logging back to RStudio and calling system("bq ls") etc..so this is enough to get me going :)
However, I would still prefer it if BQ can be autheticated within RStudio itself, as many users may log in and I'll need to autheticate via terminal for all of them. And from the service account documentation, and the fact I can get an authetication token, hints at this being easier.
For the time being, you need to run 'bq init' from the command line to set up your credentials prior to invoking bq from a script in GCE. However, the next release of bq will include support for GCE service accounts via a new --use_gce_service_account flag.

Resources