I have 24 samples (cases vs control) and I am trying to make a link in plink 2 with the following command:
plink2\
--pfile SesameBetas.csv_winfinium-mouse-methylation-manifest-file-csv_IlmnID_CHR_MAPINFO_Build_mm10_FID_IID2_NoNAChr\
--pheno C6_vs_G6.pheno\
--glm\
--allow-no-covar
when I execute the command it says flag --allow-no-covar is not recognizable
what am i doing wrong, how can i reverse this? i am new to plink and learning.
Dear all,
I have 24 samples (cases vs control) and I am trying to make a link in plink 2 with the following command:
plink2\
--pfile SesameBetas.csv_winfinium-mouse-methylation-manifest-file-csv_IlmnID_CHR_MAPINFO_Build_mm10_FID_IID2_NoNAChr\
--pheno C6_vs_G6.pheno\
--glm\
--allow-no-covar
when I execute the command it says flag --allow-no-covar is not recognizable
what am i doing wrong, how can i reverse this? i am new to plink and learning.
Related
I'm just moving my first steps with SNMP, I'm trying to add the output of a simple check script to SNMP but I'm facing some issues.
I'm trying to add a temperature check file for a Raspberry Pi 4 to be returned via SNMP to a remote poller, but just following most of the guides online lead to me to nothing, since I'm stuck with this error every time:
No Such Instance currently exists at this OID
I'm trying using the pass function but I had no luck getting any result.
Currently this is what I declared in the snmpd.conf file:
pass 1.3.6.1.2.1.25.1.8 /bin/bash /script/check_temp.sh
This is the command output:
/script/check_temp.sh
.1.3.6.1.2.1.25.1.8
integer
589
This is the command output from the poller:
snmpget -c test -v 2c 1.2.3.4 .1.3.6.1.2.1.25.1.8
HOST-RESOURCES-MIB::hrSystem.8 = No Such Instance currently exists at this OID
But if I try to run snmpd in foreground I don't actually see any error, seems instead that the script is executed:
sudo snmpd -f -Le -Ducd-snmp/pass -Drun
registered debug token ucd-snmp/pass, 1
registered debug token run, 1
NET-SNMP version 5.7.3
ucd-snmp/pass: pass-running: /bin/bash /usr/script/check_temperature/check_temp.sh -g .1.3.6.1.2.1.25.1.8
run:exec: running '/bin/bash /usr/script/check_temperature/check_temp.sh -g .1.3.6.1.2.1.25.1.8'
run:exec: got 120000 bytes
run:exec: child 7480 finished. result=768
What am I doing wrong? None of the guides I checked mentioned creating MIBS, or any other further steps than I'm already doing, but I'm still getting nothing of what I'm expecting.
Thanks in advance for any hint or suggestion that'll get me on the right way.
I hope this could help anybody trying to configure SNMP checks for their Raspberry, or any other tipycal Linux device, since most of the guides I checked were assuming you would already know some SNMP concepts, while it's possible that while you are just starting you are still not mastering them.
Most of the guides will either state to use extend or passas following:
view all included .1.3.6.1.4.1
pass .1.3.6.1.4.1.9999.1 /bin/bash /path/to/command
extend checkcommand /bin/bash /path/to/command
Like this, I faced the issues of my original question; I was able to get things working only when I added the following lines, providing an empty OID branch to the extend function and the view all accessibility to the .1.3.6.1.4.1 branch:
view all included .1.3.6.1.4.1
extend .1.3.6.1.4.1.9999.1 checkcommand /bin/bash /path/to/command
This way I actually get a reply from snmpwalk, and from snmpwalk result on OID .1.3.6.1.4.1.9999.1 you can retrieve the OID snmpd builds for the output of the script, in order to use it to make snmp queries from a poller.
I know this probably is the basis, but all the tutorials and guides I read at first were likely implying one or more of these steps, so I hope this can be of help to any other SNMP beginner.
Because of the nature of the script (done at work, on a work RHEL machine) I cannot show the code, but I can at least provide pseudocode to help with a starting point. Currently:
start loop
1) read in the first line of a host text file (then the next and such per
the loop) of a file and assign it to a variable (host name)
2) send ssh -t command to the host (which takes anywhere between 2 to 6
minutes to receive a response back)
3) log response to a text file (repeat loop with new host from read in
text file)
end loop
Currently I have to run this script over night because of how many systems this script hits.
I want to be able to achieve the same goal and get the response from the command in that file per host, but I want the command to be sent out at the same time so that it takes anywhere between 2 to 6 minutes all together.
But because this is for work, I am not allowed to install ansible on the system; would there be another way to achieve this goal? If so please provide some areas or point me in the right direction.
With GNU Parallel:
parallel -j0 --slf hosts.txt --nonall mycommand > out.txt
But maybe you want a bit more info:
parallel -j0 --slf hosts.txt --joblog my.log --tag --nonall mycommand > out.txt
I did this using sh years ago using something like:
while true
do
if [ numberOfFileinSomeDir -lt N ]
then
(touch SomeDir/hostname; ssh hostname ... > someotherDir/hostname.txt ; rm SomeDir/hostname) &
...
But this stops working after ~100 hosts. It sucks - don't do it. If less than about ~500 hosts pssh may be the easiest - maybe you can install in your home directory?
Google something like python parallel execute process multiple and someone's bound to have a script that will do what you need already.
More than ~500 hosts and you really need to start installing some tools as others have mentioned in the comments.
I've been trying to find ways to cut my Jenkins build time as much as possible, and thanks to this helpful SO post, I found pbzip2: Utilizing multi core for tar+gzip/bzip compression/decompression
Works great! A 6 min compression time was brought down to 2 mins on my machine with the following:
tar -v -c --use-compress-program=pbzip2 -f parallel.tar.bzip2 myapplication.app
But Jenkins just barfs with a Execute Shell task where I put in the above command:
+ tar -v -c --use-compress-program=pbzip2 -f parallel.tar.bz2 myapplication.app
a myapplication.appBuild step 'Execute shell' marked build as failure
The fact that the "Build step" line is getting mashed together with the output from the tar tells me it might be a background process issue that tar/pbzip2 is introducing.
I've tried introducing a #!/bin/bash -xe and get the same results. I've tried wrapping the tar command in an if statement. I've also tried putting tar in a background thread itself with & and waiting for it. Same result.
Is there any techniques I could implement to help the Jenkins process out?
Found out that even though I can run this command as the jenkins user through command line, pbzip2 wasn't defined in the PATH for the Jenkins job. Pretty misleading since there wasn't useful output.
My script first sources an API file, the executes a few commands from the file. When the script is executed from the command line, I get "command not found" errors for each of the commands. Here's the script:
#!/bin/bash
## include API file
source /cygdrive/c/path/to/unifi_sh_api
## login
unifi_login
## authorize a client for 30 minutes, limit down/up speed to 2048/1024kbps, quota is 500MB
unifi_authorize_guest "x2:ff:ff:ff:ff:ff" 30 up=1024 down=2048 bytes=500
unifi_logout
This returns "command not found" for the 3 unifi_* commands. There are no other errors.
This is on a Windows server and you can see I'm using Cygwin, so maybe that's part of the problem?
Here's what my sourced file looks like, in case the issue is there: https://dl.ubnt.com/unifi/4.7.6/unifi_sh_api
Any suggestions?
UPDATE:
Definitely using bash.
I did try . instead of source before posting my question here.
Here's the command I'm running in a cmd.exe window:
> C:\cygwin\bin\bash.exe -c '/cygdrive/c/path/to/myscript.sh'
I've got two windows machines running the latest version of cygwin. I have OpenSSH configured on both of them, and password-less authentication has been set up for the remote machine. I can ssh into either machine without problems. All commands below are executed in cmd.exe.
System Specification (identical for both machines):
Cygwin version 1.7.32
Windows 7
ver from cmd returns "Microsoft Windows [Version 6.1.7601]"
R 2.14.1
The basic form of my problem is this. I have to start an executable on my remote machine. I must start this executable via ssh through windows command line, not cygwin. That executable has a couple parameters. One of these parameters needs to be encapsulated within double quotes (Because I am working with a third party package in R, which makes a call to system(), and one parameter expects a string). The actual parameter is -e "parallel:::.slaveRSOCK()"
The script.exe called below is the file Rscript.exe. This comes with any (to my knowledge) installation of R. I did not create it, compile it, or anything. It is just utilized by the package I am trying to debug, as it allows you to execute R commands outside of the R console gui. The package I am trying to debug is "parallel", which I am using to run parallel processes on remote machines. I also did not have any hand in creating or compiling this code.
Maybe needless additional info, but the portion of the package I'm trying to debug is the function that spins up a process on a remote machine. This function develops a command, given some parameters, and executes this command in cmd.exe. I'm trying to replicate the command and manually execute, as when running through the actual package the process simply hangs.
If I were starting the executable on my machine, I would do the following, in windows cmd.
C:\Path\script.exe -e "parallel:::.slaveRSOCK()"
And this works fine. Establishing an ssh connection to the remote machine and subsequently running this command (changing C to c) also works.
But, when I make the following call for starting this script on the remote machine from my machine
ssh remoteHost c:/Path/script.exe -e "parallel:::.slaveRSOCK()"
I get the following error
bash: -c: line 0: syntax error near unexpected token '('
bash: -c: line 0: 'c:/Path/script.exe -e parallel:::.slaveRSOCK()'
So I've lost the double quotes, obviously I'm not escaping them correctly. I've tried the following call. which was close
ssh remoteHost c:/Path/script.exe -e \"parallel:::.slaveRSOCK()\"
but the second line of the error gave me
bash: -c: line 0: 'c:/Path/script.exe -e \parallel:::.slaveRSOCK()"'
Doesn't make a whole lot of sense to me, as I managed to escape the second quote but the first disappears, and I'm left with a \ before parallel.
EDIT
This one, as suggested in one of the answers
ssh remoteHost "c:/Path/script.exe -e \"parallel:::.slaveRSOCK()\""
gave me the following error
bash: -c: line 0: 'c:/Path/script.exe -e \parallel:::.slaveRSOCK()\'
Also quite an odd result, we lose both double quotes but keep the escapes
I've also tried various combinations of double quotes (single quotes) around the whole command after ssh remoteHost, and using the ^ to escape , but now it has pretty much turned into taking shots in the dark, so I thought it may be a good idea to turn to people more knowledgeable than me.
Any help or insight that can be provided is much appreciated. If there are any questions let me know.
EDIT 2
Here are some simple examples of the odd escaping that's going on.
Call:
ssh otherhost echo \"hello()\"
Returns:
bash: -c: line 0: unexpected EOF while looking for matching '"'
bash: -c: line 0: syntax error: unexpected end of file
Call:
ssh otherhost echo \"hello()"
Returns:
hello()
Call:
ssh otherhost echo '\"hello()\" '
Returns:
"hello()"
Call:
ssh otherhost echo "\"hello()\""
Returns:
hello\(\)
Alternatively, an explanation of this behavior would be appreciated.
I think you want:
ssh remoteHost "c:/Path/script.exe -e \"parallel:::.slaveRSOCK()\""
I honestly can't fully explain the reasoning behind the quoting (or what's screwing it up if it's a bug), but I think this will work for you:
ssh remoteHost "c:/Path/script.exe -e \"parallel:::.slaveRSOCK\(\)\""
The complication seems to be the following sequence of things parsing the command line(s):
Windows cmd.exe on the local machine gets and parses the whole thing
ssh sends the "c:/Path/script.exe -e \"parallel:::.slaveRSOCK()\"" portion to sshd on the remote Windows host. I'm not sure in what form sshd gets this command line, or exactly what transformations it might do to it.
sshd apparently invokes bash to run the command (thorough some cygwin mechanism?). Again, I'm not sure of the exact form the command line that gets to bash.
bash gets confused unless the parens are escaped, and the backslashes seem to get far enough through this assembly line of processes to make bash on the remote windows-with-cygwin machine happy.