summaryrefslogtreecommitdiff
path: root/.local/bin/sync_documents
blob: 53663da77ebaee809f0a84c637f484874f790f0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh

# the target drive
fileserver="/media/share"
# where the files will trasfer from
origin=""
# where the files will be transfered to
dest=""

# make sure the file server is mounted
if grep -qs "$fileserver" /proc/mounts ; then
        echo "The drive $fileserver is mounted"
else
        echo "The files cannot sync because filesystem $fileserver is not mounted." 
        exit 1
fi

# first sync changes to file server
rsync -Prv $HOME/school_files /media/share
# then sync back
rsync -Prv /media/share/school_files $HOME

rsync -Prv $HOME/passwords /media/share/documents
rsync -Prv /media/share/documents/passwords $HOME/passwords

echo "All done"

exit 0