|
Hot offers:
|
BASH PROGRAMING! (Linux)I have a script that I wrote and I need it extended,
I need the script to compare a directory list to a user variable if the directory does not exist then it needs to be created. Then the users remote directory gets mounted (there are multiple users) then an rsync takes place. Please notice how I create the directories daily by date! Your job is to fix up this script, I got the script to compare usernames by the number of letters and thats wrong. so i need a spot to enter the mount points as well and to get the script to compare and care directories. my budget is $ 30 #!/bin/bash users=( ysapir david rpril zrobinson ) emailadd= hostname=`hostname` directory=`date +%Y-%m-%d` echo $ {users[@]} echo $ directory foonum=$ {#users} count=0 for d in $ ( ls /backup/ ); do echo $ {d[@]} for ((i=0;i<$ foonum;i++)); do if [ "$ {users[$ {i}]}" = "$ {d[@]}" ] ; then echo $ {users[$ {i}]} directory is synced mount //192.168.1.11/MyDocuments/Backup /mnt/$ {users[0]}/ -o username=ysapir,password=zublahzublah rsync -av /mnt/ysapir/ /backup/$ {users[0]}/$ directory | tee /tmp/rsync.log cat /tmp/rsync.log | mail -s "$ (date)" cat /tmp/rsync.log >> /var/log/rsync/log umount //192.168.1.11/MyDocuments/Backup let "count += 1" fi done done echo "COUNT: " . $ {count} echo "FOONUM: " . $ {foonum} if [ $ {count} != $ {foonum} ] ; then echo Usernames are not synced, please verify variable. else echo Usernames are all synced. fi Latest Related projects:Currently viewed: "BASH PROGRAMING!"All for Freelancers version: "BASH PROGRAMING!" |