I am using rsync to back up a folder on a local machine to a remote machine.
The link destination folder is on the remote machine as is the target. When using the command line it works fine - using link-dest=../../link - that being the location relative to the target directory. When I try to put this into a script on the local machine it failed to exec --link-dest=../../link. In the script I have a variable LNK="../../link/" and TRG="remote#user:home/user/target. I am pretty new to scripting but this has stumped for a few days now.
I did try the full path on the LNK variable remote#user:home/user/link - same result
Related
I am running a R and python script in a docker container. both scripts save the file to the working folder, but when running a container, there is no local folder.
what changes do I need to ensure that the file goes to the downoads folder of the person running the container?
do I need to update my R and python scrips such that the files are saved to the local host download? If so, what would that look like, as there is not a localhost.
In R, I updated my saving file location to :
write.csv(data,
paste0('C:/Users/',Sys.getenv("USERNAME"),'/Downloads/file_made_by_r_script.csv'))
but while running the container, the resulting file is not found in my downloads folder.
I tried mounting a volume as per Write files outside of a docker container via python, but cannot do that while the container is hosted in azure
I am trying to sync a remote directory to the local system directory wimagasin inside the htdocs on the mamp server.
I ran the command from my local htdocs directory:
rsync -avr deploy#wimagasin.se:public_html/wimagasin.se wimagasin
But when the command is run, the sync creates completely new directory wimagasin.se inside my local wimagasin directory. I am not sure what is the right way to do this?
You should just append a slash at the source:
rsync -avr deploy#wimagasin.se:public_html/wimagasin.se/ wimagasin
We want to upload files to a WebDAV-Folder and tried to use the "Windows Machine File Copy"-task for that (this uses ROBOCOPY inside). But we donĀ“t see any possibility to enter the destination folder in the right form.
1. We tried
\\our.website.de#SSL\DavWWWRoot\remote.php\webdav\
and
2. we also mounted this location as a network drive first and tried to use the drive letter,
but none of these attempts succeeded.
Is "Windows Machine File Copy" the right type of task for that or is there any custom task out there that accomplishes what we need?
Thx...
You should separate specified Machines and the folder path. Do not use it together.
Machines:
Example: dbserver.fabrikam.com, dbserver_int.fabrikam.com:5986,192.168.34:5986
Folder Path:
The folder on the Windows machine(s) to which the files will be
copied.
Example: C:\FabrikamFibre\Web
More detail info please refer this link: Deploy: Windows Machine File Copy
I have a directory on my desktop and need to copy it to my server. I've looked up a command to do this being
scp -r /path/to/local/storage user#remote.host:/path/to/copy
but when I run it, it just tells me "No suck file or directory".
First of all is this the correct way to do this or is there an easier way to take a directory from local storage and put it onto an apache server? Once I get it on the server I can move it around just fine there. I just need to get it on there!
the path I'm using right now for local is
/Users/byw5k_000/Desktop/myWebsite
with myWebsite being the directory I want to copy onto my server.
I'm curious if I'm getting the path incorrect. What is the correct path to the desktop on a windows 10 computer and will this work for me to copy an entire directory onto an apache server?
You could try changing to your Desktop directory like this:
cd C:\Users\(username)\Desktop
and then running:
scp -r myWebsite user#remote.host:/path/to/copy
Should work as ling as you can change to your Desktop directory
I am trying to get deploy root directory of my servlet based project from java. I am using the following lines of codes to get the path details.
Type 1:
File directory = new File (".");
try {
System.out.println ("Current directory's canonical path: "
+ directory.getCanonicalPath());
System.out.println ("Current directory's absolute path: "
+ directory.getAbsolutePath());
}catch(Exception e) {
System.out.println("Exceptione is ="+e.getMessage());
}
Type 2:
String currentDir = System.getProperty("user.dir");
System.out.println("Current dir using System:" +currentDir);
While executing the above codes from main class i am getting user directory. When i executes from server side, gets as, "Current dir using System:D:\Apache Tomcat 6.0.16\bin". But my project is located in D:\Apache Tomcat 6.0.16\wepapps\SampleStructs.
Please give me any suggestions for this and help me out of this.
First of all, the main cause of your problem is the difference between current working directory and the location of your executable. You should know that current working directory in Linux is not the directory where the executable is, but instead the current directory where the program was started from.
As an example, let's say you have a program current which prints out the current directory and it is located in /home/user/scripts/.
If you do this:
cd /home/user/scripts
./current
It will print out: /home/user/scripts/
But, if you do this:
cd /home/user/
scripts/current
The output will be: /home/user/
As to the possible solutions, some of them I found useful are:
Refer to your project resources relative to the classpath, see ClassLoader.getResourceAsStream() for more info
Refer to your configuration resources, like properties files and such, relative to the user home directory.
Put all other locations, such as media directory path and similar to the configuration file from the point above.
If all other options are not available or practical use getClass().getProtectionDomain().getCodeSource().getLocation().getPath(). See more about this approach and some possible issues here: How to get the path of a running JAR file?
It because when you execute from main class everything is fine, but this code runs on server it looks into current directory and current the directory structure is Apache 'bin' from where you have started the server(run.bat).
you can use this code
String absolutePath = getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
absolutePath = absolutePath.substring(0, absolutePath.lastIndexOf("/"));
this code is working before for me!
it will return the full path of folder in windows or linux.
There are different context we are talking about here.
1. Running the application in standalone mode.
2. Running the application in container on server side.
In #1, The application is run from the directory it is invoked.
But #2 case, the application is run relative to the container, so you see the location of server directory. This also shields the application code.