File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -15,9 +15,12 @@ Purple='\033[0;35m' # Purple
15
15
Cyan=' \033[0;36m' # Cyan
16
16
White=' \033[0;37m' # White
17
17
18
-
18
+ set -o pipefail
19
19
readonly file=" $2 "
20
20
readonly u_folder=" $3 "
21
+ readonly status_dir=" $( mktemp -d) "
22
+
23
+ trap " rm -rf $status_dir " EXIT
21
24
22
25
dependencies () {
23
26
echo " "
@@ -108,9 +111,9 @@ rclone_progress_bar() {
108
111
echo " Starting download..."
109
112
rm -f log
110
113
touch log
111
- rclone -P --checkers=32 --onedrive-chunk-size 60M copy " $file " oned:/" ${u_folder} " | tee log > /dev/null || DL_FAILED=true &
114
+ rclone -P --checkers=32 --onedrive-chunk-size 60M copy " $file " oned:/" ${u_folder} " | tee log > /dev/null || touch " $status_dir /failed " &
112
115
until [ -z " $( jobs -r) " ]; do
113
- if [ -n " $DL_FAILED " ]; then
116
+ if [ -f " $status_dir /failed " ]; then
114
117
echo
115
118
echo " ${Red} Upload failed!${Normal} "
116
119
break
@@ -195,7 +198,7 @@ upload () {
195
198
echo " Initializing process, might take up to 10 seconds..."
196
199
rclone_progress_bar
197
200
wait
198
- if [ -n " $DL_FAILED " ]; then
201
+ if [ -f " $status_dir /failed " ]; then
199
202
echo -e " \rUpload Failed .......\n"
200
203
exit 1
201
204
fi
You can’t perform that action at this time.
0 commit comments