Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
when I execute the command , it asks me password and wait for almost 10 seconds(usually it takes 10 secs to run measure.sh). measure.sh is supposed to also redirect result of script to a file, when normally I run script on the machine its located, I can see the output file, but when I run it remotely, the output file is not created. I do not know what is the problem and any help is appreciated.
1. It asks for root password for the machine where you're trying to login.
2. It either takes time in establishing connection, or there's some issue with shell on remote machine. May be a different shell configured for root on remote machine as compare to your local machine. So once invoke:
Code:
~$ ssh root@192.168.122.193 "echo $SHELL"
Also check if /home/guest/Desktop/measure.sh exists on remote machine or not? I doubt it's on your local machine, and you're trying to run it on remote machine.
3. If output file isn't generated then I doubt that your script is running on remote server or may be it doesn't exist on remote machine. So once login on remote machine and invoke it (not with ssh) like:
But again the log file(which should be measure_download.log) is not created. In fact the script is downloading a file from server and measure the time. Even the file which should be downloaded does not exist.
What I noticed is the following:
the downloaded files and log are created in the root directory (/root/)of remote machine. But I need them to be in the Desktop, I know that I can write script to move them to Desktop, but I have more than 100 experiments and I should to that for all of them. I just want to fix this problem.
also does not work, but if after ssh I enter the directory containing script and run it it works. I guess the problem is I can run it outside its directory.
Most likely the log has been created in the HOME directory of the remote machine (and maybe even the file was downloaded there). You have to options: use absolute paths inside the script or change to the directory containing the script itself. You can do this from inside the script in a reliable way using:
Alright. I guess that problem is with difference in shebang (script interpreter) and login shell.
If both are not same, then you will need to run script with shell name.
So check if shebang (script interpreter) is also #!/bin/bash. And in that case, you can invoke script like:
Code:
~$ /home/guest/Desktop/measure.sh
Else, you would need to invoke it as (depends upon shebang):
The default dir is the one you login to, so $HOME, even though you call it in /home/guest/Desktop.
Easiest fix is to cd /home/guest/Desktop at the top of the script, before it does any processing.
Alternately, tell the process (downloader?) where to put files/logs.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.