General :: Executing Commands Remotely Using Scripts?
Jul 8, 2010
For routine tasks i have to execute commands on machines running both winxp and linux. I usually do it via telnet. But the process is very manual as i have to authenticate for each machine then specify the command.
Is there any way that i could automate this job using a script or so?
I have a USB modem on a Debian install that I want to be able to use AT commands to diagnose, specifically for obtaining signal strength (RSSI). I know the command for this is AT+CSQ but I cannot seem to get the interface for issuing AT commands to work.
The modem is using /dev/ttyACM0 and when I try to use minicom, I type in AT commands and nothing is echoed to the screen (Yes, echo is turned on). Maybe I just don't know how to use minicom correctly.
i just want to know whether we can execute the commands in invisible mode in linux. i.e.the command we typed must be executed but should not be visible.is it possible.
if not,then how the password we are typing is not visible in linux,while creating or entering password for users.
In a script I am writing I am trying to add logic so that the script can figure out if a remote server uses rpm or dpkg and then run the appropriate command to print a list of installed packages. This works locally, but I need to get it to work through SSH and I have no idea how to do that. The relevant portion of the script is below. It would also be nice to find a way to not need the full path to the executables but I'm not real concerned about that.So anyone know how to make this code work via SSH?
Code: if [ -x /usr/bin/dpkg ]; then dpkg --get-selections
I have setup lirc on my htpc and it works perfectly, but I am trying to use irexec to execute commands from my remote controller, and this does not work.
Basically, I loosely based my setup on this thread at the XBMC forums (starting at step 3 because lirc is configured and runs the Slackware way !): [URL]
The thread on XBMC's forum uses irexec and irxevent to execute commands. I am not 100% sure why irxevent is used but I am interested to know why and what it really does...
but irxevent wouldnt start normally. My understanding is that irxevent uses the display of the parent owner (in my case root since it is called from rc.local) so I tried to start it as normal user and it worked.
So on top of my problem executing commands with irexec, I would like to know how to execute a process as a different user so I can have irxevent started as a normal user by the system at boot time?
I made a small script to passwordless login to server with sshgnome-terminal --command "ssh myserver"I can login but i want to execute a command, lets say a "ls".So when i doubleclick the script it should login (which works) and gives me a listing (ls) on that server.gnome-terminal --command "ssh myserver" ---> and then execute ls on that server.
wanted to know if i can execute commands on linux console through a web page and redirect it back to my web page !For example :if i send a query "ls"it should execute this command on my linux console and also redirect the list of the files to the web page from which i give the command !
I'm not terribly new to Linux, but I am new to the forums, so hear me out! I am in the process of creating an electronic mapwall for our meteorology program, and have designed the computing system from scratch. I have two Linux Boxes, each with capabilities for 6 attached monitors...a total of 12 displays driven from two machines. My intention is to have one machine be the master...it has a touchpanel control. The inputs to the touchpanel will then trigger events for the both the master and the slave machine to display. Each of them has a specific IP address (DNS entry), and are not on a subnet.
Now...is there a way to remotely login to the slave machine and have it display on it's OWN monitors? The code is Java and which works on the master machine to animate directories of .gifs for each of the master's attached monitors. I will most likely have Java execute shell commands for the remote login (ssh), but I believe the answer lies somewhere in the X-configuration. Do I have the machines in an adverse configuration (creation of a subnet would be better)? Lots of questions...lots of desire...few answers!
My present working is Code: linux:/home/anisha/downloads/mapnik-0.6.1/demo/c++ # Now I want to run "python scons/scons.py" located in Code: linux:/home/anisha/downloads/mapnik-0.6.1/ #
I tried Code: ../../python scons/scons.py From the above stated PWD but it resulted in the following: Code: bash: ../../python: No such file or directory What is the way to execute a file of some other directory from the PWD!
I have a some c source code files that i have to copy to linux machine from a windows machine over a network. This source code folder has to be copied into a particular directory structure in the linux system at the other end. After copying the file into the appropriate folder in the linux server i have to instruct the linux machine to make(using the make file that is there with the c files) this source code from the windows machine. Does anyone have any idea in regard to how this can be implemented?? i am trying to have a gui client that has the above mentioned options(copying and inserting the c files into the appropriate directory and then for making the files and getting the executable.)
i want to do a setting to dynamically monitor my Work Station on my Wifi network. I've got my name server BIND and my dhcpd server all of that under linux working perfectly. But i didn't find any option to execute a script when dhcp give an IP to a machine. I would like to know if there is a way to do that. If there is no options for that i'll use the log files.
I tried to execute a shell command by M-! cmd RET but it did not work.M-! does not turn up in the microbuffer no matter how many times I press Alt+!.But if I go to Tools menu and select Shell Command... option then it writes M-! to the microbuffer and everything works fine.What is the problem here?
I am running to a weird issue: for some reason when I try to run a crontab script which has these two operations: #!/bin/sh DATE=`date +%F`
but when I reduce this script to the first sql backup only and I use another cron job to put this dump file to the folder it goes through...weird isn't it?so 1+2 in 1 cronjob don't work but 1 in 1 cronjob and 2 in another cronjob it works perfect. any thoughts?
I have procmail parsing the subject line of incoming e-mail and depositing individual files in a folder that match the procmail recipe.I want to have that recipe spawn a perl script to parse the file to pull out specific information. I've googled this and found many examples but none of them work.When it finds a matching inbound message it logs it correctly in the charge.log file, writes the message in charges/new/xxx but skips the /home/rowan/billing.pl script.
I want login.sh shell script executing automaticaly whenever i open the console..?and also logout.sh shell script executing automaticaly whenever close the console.
I'm trying to run an application from the command prompt. I've set the path in .bashrc. My executable file and all other files needed by it are saved in the same directory as the path. When I enter the executable name to run it, I get an error message saying that the command is not found.
i have n files and each file has 5-6 .sql files.Now I need to wrie a shell script that executes all the n files in parellel and for each n file the .sql files sequentially.eg
I am running Yellow Dog Linux release 6.2(Pyxis) on my PS3. I would like to compile and run C programs that utilize OpenMP for parallel programming. Unfortunately, I have not been very successful. I am able to compile programs containing OpenMP statements error free, but when I attempt to execute the binaries I receive the following error: Code: ./file: error while loading shared libraries: libgomp.so.1: cannot open shared object file: No such file or directory Compiling programs without OpenMP statements works fine.
Because it has to do something with missing libraries, I am not sure if knowing the executable search paths may help in diagnosis, but when echoing the path environment variable:
[Code]...
The version of GCC on this machine, 4.1.2 20080704 (Red Hat 4.1.2-44), is identical to the ones I have on two other machines (CentOS release 5.3 (Final) and CentOS release 5.4 (Final)) and they both compile and execute OpenMP code flawlessly. I have tried building and installing another version of GCC that would possibly include the OpenMP libraries, since, according to some sources, GCC has only supported OpenMP since version 4.2. But I have not been successful with that either (that problem would make a good second thread.)
In my code I want to have two different functions to be executed simultaneously (in parallel) in a single processor system. I tried to use pthreads but they happened to be executed one after another. I have heard about fork, some saying that its no longer recommended since its functions can be achieved by pthreads.
I have the following command:ssh $USER@$HOST "ls /ops/pkg/ec/`grep "PKRTS" /ops/pkg/ec | awk '{print $1}'`* > /tmp/tmp_file"What the above SHOULD do..is, ssh to the host then execute the command.The command should first execute the grep and awk between the back ticks, and generate a file name, then ls using that filename* and write that data to a temp file.However, it executes the grep and awk before even SSH'ing and the command that goes to the server is simply an "ls /ops/pkg/ec/* > /tmp/tmp_file" since the grep and awk return nothing on the local machine.
I'm using Ubuntu and I'm programing with eclipse CDT. My goal is to execute a php file and read the output to my c++ program. To do so I thought I should use fork(), dup2() and execl. When in shell, the call "php myscript.php" worked just fine, but when in c++ I tried: execl("usr/bin/php", "php", "home/geiger/workspace/SemiServer/server_content/myscript.php", NULL); And it didn't work (the process wasn't terminated and I got no output). I tried different version of this call, like losing the "php" string and/or drop "home/geiger" from the path string, to no better result.
I am writing a script which will fetch data from different machines and display it on single terminal. I have created a file named SERVERNAMES containing ip address of machines I need to monitor. Then for every IP I am issuing ssh command to get date on that machine. However When I am trying it on the script it is just giving me output of first server and it is ignoring rest servers mentioned in file. ssh works fine without password for all machines mentioned in SERVERNAMES.
Code: #!/bin/bash while read line do #Calculate Load on remote machine. Date=`ssh -T -q $line date` echo "Date on $line is:$Date" done < SERVERNAMES
Code: output. Date on 10.180.8.231 is:Wed Jul 14 10:48:46 IST 2010 I am not getting the output for . Code: 10.180.45.235 10.180.45.238 10.180.45.211 Is there anything wrong in ssh?
I want to execute a awk command, which reads from txt files and sums the numbers from the first column for those listed only inside a <init> block -- The awk command is like
So, I want to execute it inside a perl script, and execute the awk command for the infile which is also defined outside awk loop, ie doing something like
Code:
foreach $infile (@ARGV) { $gzin = gzopen($infile, "r") || die ("Couldn't open file $infile "); # No. events and cross-section from current file