I have the following script:
#!/bin/bash
PATH=...
echo 'Syncing database dumps'
rsync ssh user@XX.XXX.XXX.XX:/test/ /test
echo 'Creating symlink'
ln -s test /tmp/test
Only the first command and all echo's are run. If I comment out the first command, then the symlink command is run:
#!/bin/bash
PATH=...
echo 'Syncing database dumps'
#rsync ssh user@XX.XXX.XXX.XX:/test/ /test
echo 'Creating symlink'
ln -s /test /tmp/test
The rest do not run. Any ideas why?
Edit, based on recent comment, added the -v option to the symlink command. Now I can see that all the commands do run. But they do not run in the sequential order they are set in. The symlink command will run BEFORE the rsync command has finished. How can I set the order so the symlink command is only run after the rsync command has finished?
Try rsync's --blocking-io option, ie
rsync ssh --blocking-io user@XX.XXX.XXX.XX:/test/ /test
Alternatively you could use scp if your protocol is ssh anyway
scp user@XX.XXX.XXX.XX:/test/ /test
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.