Sponsored Content
Full Discussion: Help with rsync script
Top Forums Shell Programming and Scripting Help with rsync script Post 302568068 by Noura-83 on Wednesday 26th of October 2011 06:15:45 AM
Old 10-26-2011
Help with rsync script

Good day all,

I need your help in editing a rsync script that I am trying to write and using ksh shell.

I want to add multiple patterns --include and --exclude options with variable inputs called SID. I have created two files and named them N1 and N2 and created subfiles in each one

In N1 file I want all files to be skipped and the files start with A1 to be transferred but when I run the script it didn't work.

The script is located in a file called s

Here what I wrote:

Code:
para::/home/noura/SBt/N1> ls -ltr
total 8
-rwxrwxrwx 1 noura basis 0 Oct 25 14:11 A1
-rwxrwxrwx 1 noura basis 0 Oct 25 14:11 A2
-rwxrwxrwx 1 noura basis 0 Oct 25 14:11 A12222
-rwxrwxrwx 1 noura basis 0 Oct 25 14:11 A22222
-rwxrwxrwx 1 noura basis 0 Oct 25 14:12 A13333
-rwxrwxrwx 1 noura basis 0 Oct 25 14:12 A24444
-rwxrwxrwx 1 noura basis 0 Oct 25 14:18 A29999
-rwxrwxrwx 1 noura basis 0 Oct 25 14:18 A18888
-rwxrwxrwx 1 noura basis 0 Oct 25 14:19 Nora
-rw-r----- 1 noura basis 0 Oct 25 14:24 N111111
-rw-r----- 1 noura basis 0 Oct 25 14:25 A1234455
-rw-r----- 1 noura basis 0 Oct 25 14:30 A1098776
-rwxrwxrwx 1 noura basis 352 Oct 25 14:35 s
para::/home/ noura /SBt/N1> vi s
#!/bin/ksh
 
SIDid="A"
echo SIDid $SIDid
A="$SIDid"2*
echo A is : $A
 
 
/usr/bin/rsync -avz --ignore-errors /home/ noura /SBt/N1/ --include='"$SIDid"1*' --exclude='"$SIDid"2*' /home/ noura /SBt/N2

And this is the script output:

Code:
SIDid A
A is : A2 A22222 A24444 A29999
building file list ... done
./

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rsync script in cron from stepping on itself

I have the following rsync script that I use for syncing MySQL files from one server to another. I run the script at 20 minutes past every second hour in cron. I want to make sure that the script completes in it's entirety before it is set to kick off again. For example, when the script starts at... (3 Replies)
Discussion started by: sunsysadm2003
3 Replies

2. Shell Programming and Scripting

rsync script ...

Hi all, I am a newbie in unix and i want a script which should sync files between two servers like rsync. The condition is that. after rsync command is completed it should also list me how many files has been changed during the rsync execution. if the rsync execution has failed , then... (2 Replies)
Discussion started by: abalakrishnan
2 Replies

3. Shell Programming and Scripting

rsync - storing password in script

Hello, I wish to store the password in an rsync script so that when prompted it just enters the password. I know I can set up passwordless logins, but I have never been able to do this on this particular server so I am resorting to storing the password in the script: rsync -avz -e ssh... (4 Replies)
Discussion started by: stuaz
4 Replies

4. Shell Programming and Scripting

rsync script for synchronisation and backup

hello, i need to modified my synch/back scripts.... i want that this script only syncro folders in destinationfolder. f.e. when in destination are two folders 1) admin 2) users but in SOURCE are three: 1) admin 2) users 3) antivirus the script should only increnmential sync the... (0 Replies)
Discussion started by: onkeldave
0 Replies

5. Shell Programming and Scripting

Help with changing rsync script

#/bin/bash #set -vx DST_SRV=<destination_hostname> MDATE=`date +%Y%m%d%H%M` SRC_CONTENT="/home/prad/sourcecontent/" DST_CONTENT="/tmp/prad/destinationfolder/" DST_LOG="/tmp/prad/STATS" CURRENT_LOG="/home/prad/STATS/rsync-current.log" EMAIL="/home/prad/EMAIL/email.log"... (3 Replies)
Discussion started by: pnara2
3 Replies

6. UNIX for Advanced & Expert Users

Rsync Script Modification

Hi I have a rsync that runs from a remote location to our central data store. The sync generates a log locally not in the central location. I would like to modify the rsync to add the following The log, instead of filing locally it gets sent to a area on the central data store once the syncs... (0 Replies)
Discussion started by: treds
0 Replies

7. Shell Programming and Scripting

Help with rsync script

Good day all, I need your help in editing a rsync script that I am trying to write and using ksh shell. I want to add multiple patterns --include and --exclude options with variable inputs called SID. I have created two files and named them N1 and N2 and created subfiles in each one In N1... (1 Reply)
Discussion started by: Noura-83
1 Replies

8. Shell Programming and Scripting

Cp script like rsync

Hi Folks, I have a NAS running busybox with a ARM processor. Several PC's backup full weekly and several daily incrementals to the NAS. The NAS has two USB attached disks, which are swapped off site weekly. The problem is the built in rsync only transfers at 2Mb/s to the external USB... (2 Replies)
Discussion started by: bigal.nz
2 Replies

9. Shell Programming and Scripting

Help with rsync file restore script

Hello Friends, I am trying to create an rsync file restore script. I will post want I have below and explain the problem I am having. #!/bin/bash # # Partial Rsync File Restore Script # # clear echo # Shell loads into /raid0/data/backup/bin/ cd .. # I cd to the backup... (1 Reply)
Discussion started by: jdavis_33
1 Replies

10. Shell Programming and Scripting

Rsync Error: rsync: link_stat failed: No such file or directory (2)

I wish to copy all the files & folder under /web/Transfer_Files/data/ on mymac1 (Linux) to remote server mybank.intra.com (Solaris 10) /tmp/ location I am using Ansible tool synchronize module which triggers the unix rsync command as below:rsync --delay-updates -F --compress --archive --rsh=ssh... (2 Replies)
Discussion started by: mohtashims
2 Replies
rsync_selinux(8)					rsync Selinux Policy documentation					  rsync_selinux(8)

NAME
rsync_selinux - Security Enhanced Linux Policy for the rsync daemon DESCRIPTION
Security-Enhanced Linux secures the rsync server via flexible mandatory access control. FILE_CONTEXTS SELinux requires files to have an extended attribute to define the file type. Policy governs the access daemons have to these files. If you want to share files using the rsync daemon, you must label the files and directories public_content_t. So if you created a special directory /var/rsync, you would need to label the directory with the chcon tool. chcon -t public_content_t /var/rsync To make this change permanent (survive a relabel), use the semanage command to add the change to file context configuration: semanage fcontext -a -t public_content_t "/var/rsync(/.*)?" This command adds the following entry to /etc/selinux/POLICYTYPE/contexts/files/file_contexts.local: /var/rsync(/.*)? system_u:object_r:publix_content_t:s0 Run the restorecon command to apply the changes: restorecon -R -v /var/rsync/ SHARING FILES
If you want to share files with multiple domains (Apache, FTP, rsync, Samba), you can set a file context of public_content_t and pub- lic_content_rw_t. These context allow any of the above domains to read the content. If you want a particular domain to write to the pub- lic_content_rw_t domain, you must set the appropriate boolean. allow_DOMAIN_anon_write. So for rsync you would execute: setsebool -P allow_rsync_anon_write=1 BOOLEANS
system-config-selinux is a GUI tool available to customize SELinux policy settings. AUTHOR
This manual page was written by Dan Walsh <dwalsh@redhat.com>. SEE ALSO
selinux(8), rsync(1), chcon(1), setsebool(8), semanage(8) dwalsh@redhat.com 17 Jan 2005 rsync_selinux(8)
All times are GMT -4. The time now is 09:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy