I'm using rsync command to deploy symfony 4 project to remote server, every time when I make new change the command deploy all the project's file instead of new files !! which option to add to tell rsync that should only transfer new changes!
I'm using rsync like that :
rsync -av LocalProjectPath RemotePerverPath --include=public/.htaccess --include=public/build --include=vendor --exclude=".*"
I can refer you to this page for detailed information:
https://www.tecmint.com/sync-new-changed-modified-files-rsync-linux/
rsync has built-in parameters for those purposes
"--ignore-existing" allows you to transfer only new files.
"--update --dry-run" allows you to transfer only updated and modified files.
Related
I have a Gitlab repository containing a WordPress theme - php, js, and css files. My desired result is that when I push a change to the 'main' branch of the repo, the theme files are deployed, raw, without any build or test steps, to my remote server.
I have a .gitlab-ci.yml file set up with 'deploy' as its only step.
The script triggers on 'only: -main' and successfully accesses my remote server via ssh.
What I'm unsure of is how to send the entire raw repository to the remote.
Here is the 'script' portion of my yml:
- rsync -rav --delete project-name/ /var/opt/gitlab/git-data/repositories/project-name/ username#my.ip.add.ress:public_html/wp-site/wp-content/themes/
When the pipeline runs, I receive the following two errors:
rsync: [sender] change_dir "/builds/username/project-name/project-name" failed: No such file or directory (2)
rsync: [sender] change_dir "/var/opt/gitlab/git-data/repositories/project-name" failed: No such file or directory (2)
Is GitLab looking in /builds/ its default behavior? I am not instructing it to do so in my yml.
Is there some other file path I should be using to access the working tree for 'main' in my repository?
Ok, I misunderstood the rsync syntax. I thought the --delete flag included a parameter thereafter, meaning 'delete any existing files in the following directory' rather than what it actually does, which is to auto-choose the destination directory. Once I removed 'project-name/' and corrected the GitLab (origin) file path to '/builds/username/project-name/' the deployment occurs as intended.
I have delete 1 file locally and added new files locally, i dont want to sync those new files to the remote system but rather delete only the one that has been removed from src.I tried the command below but it deletes file from remote also.
rsync -avh --delete /home/ssastry/ ssastry#10.196.105.121:/tmp
I want the only file deleted from local to get deleted from remote . i dont want new additions.
Try below command.
rsync -r --delete --existing --ignore-existing /home/ssastry/ ssastry#10.196.105.121:/tmp
From man page:
--existing :skip creating new files on receiver
--ignore-existing : skip updating files that exist on receiver
I want to download only new files from one SFTP server using WinSCP.
Suppose, I have 10 files in source and destination today.
Tomorrow one new file may be added to the source. In this scenario, I want to copy the new file only into destination.
I am using below script:
open sftp_connection
cd /path
option transfer binary
get "*.txt" localpath
close
exit
By using above, I am able to copy all files, but I want only new files which are not available in destination.
Thanks,
Srikrishna.
The easiest solution is to add -neweronly switch to your get command:
get -neweronly *.txt C:\local\path\*
For a very similar results, you can also use synchronize command:
synchronize local . C:\local\path -filemask=*.txt
See also WinSCP article on Downloading the most recent file.
Hi I am deploying my spring application to Openshift Jboss AS. The problem is whereever i placed the log4j.properties it is not read by the application. I've tried the following ways to achieve this but can't.
Placed my log4j.properties in WEB-INF/classes.
Placed my log4j.properties in WEB-ING/resources and in web.xml loaded the
context-param for log4jConfigLocation.
Created a
jboss-deployment-structure.xml in META-INF which excludes log4j
logging.
Nothing seems to work . Can some one please help me.
In Jboss there is a default logging available, which can be implemented by modifying standaole.xml.
In Openshift when you ssh into your app using the below command
rhc ssh <app-name>
You will taken into your application where when you give ls command you will see the list of files and folders, you can find jbossas folder change your working directory to that folder
cd jbossas
execute ls command you will see list of folders where you will find standalone folder, change your working directory to this folder
cd standalone
again execute ls command you can see configuration folder, change your working directory to this
cd configuration
now if you execute ls command you can see standalone.xml, we need to edit this file, but editing here may not work because this standalone.xml is a copy of the another file which is in the following folder .openshift/config/standalone.xml . You can find this folder where you clone your git copy, Not in eclipse go to your working directory in window.
We need to edit this file and add our logging properties here. thats how it works
I want to prepare a pre-compiled package of ASP.NET MVC 4 site.
I can precompile it using commandline as follows:
aspnet_compiler -nologo -v / -p "C:\WebSite1" -u "C:\TargetPath"
However it baffles me, why aspnet_compiler requires virtual path. What if I decide later on to deploy this package to an IIS server under different path? Could it cause some run-time problems?
By deployment I mean here simple xcopy deployment.
If you specifiy the physical path of the source with the -p switch, then the virtual path is required. I reluctantly submit this page http://www.asp.net/web-forms/tutorials/deployment/deploying-web-site-projects/precompiling-your-website-cs for some info on how the -v can play in with app relative references ie ~/path/file. What he says needs more qualification and does not appear to apply to apps under the default IIS site.
His explanation is that using -v /MySite will change references from ~/path/file to ~/MySite/path/file. However I have not experienced this behaviour. Atleast as far as compiling apps that are under the default IIS website (regardless of being on the root of the site or nested). If I compile with for instance /v kart, inline references and codebehind references to "~/path/file" arrive in the dll as "~/path/file", not "~/kart/path/file". I have had no runtime problems deploying my WebForm apps elsewhere where the app root is now at a different path.
If you are compiling apps that are under the default IIS website, it is redundant to use -p with the physical path to the source and -v with the virtual path. If you omit the -p switch it will compile the same as only using the -v. Being redundant with the -p and physical source path may be nice when reviewing a batch file to have the source location documented.