LINUX.ORG.RU

curl висит в цикле

 


0

1

последний цикл приходится убивать ctrl+c причем сразу за ним done

вот пример

Trying 192.168.1.1:21...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 192.168.1.1 (192.168.1.1) port 21 (#0)
 220 (vsFTPd 3.0.5)
 USER admin
 331 Please specify the password.
 PASS admin
 230 Login successful.
 PWD
 257 "/mnt/bzip2" is the current directory
* Entry path is '/mnt/bzip2'
* Request has same path as previous transfer
 EPSV
* Connect data stream passively
* ftp_perform ends with SECONDARY: 0
 229 Entering Extended Passive Mode (|||35867|)
*   Trying 192.168.1.1:35867...
* Connecting to 192.168.1.1 (192.168.1.1) port 35867
* Connected to 192.168.1.1 (192.168.1.1) port 21 (#0)
 TYPE I
 200 Switching to Binary mode.
 STOR 27.09.24-04:54:35:114055900-1.bz2
 150 Ok to send data.
} [291 bytes data]
* We are completely uploaded and fine
* Remembering we are in dir ""
 226 Transfer complete.
100   291    0     0  100   291      0   5168 --:--:-- --:--:-- --:--:--  5196
* Connection #0 to host 192.168.1.1 left intact
*   Trying 192.168.1.1:21...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 192.168.1.1 (192.168.1.1) port 21 (#0)
 220 (vsFTPd 3.0.5)
 USER admin
 331 Please specify the password.
 PASS admin
 230 Login successful.
 PWD
 257 "/mnt/bzip2" is the current directory
* Entry path is '/mnt/bzip2'
* Request has same path as previous transfer
 EPSV
* Connect data stream passively
* ftp_perform ends with SECONDARY: 0
 229 Entering Extended Passive Mode (|||55069|)
*   Trying 192.168.1.1:55069...
* Connecting to 192.168.1.1 (192.168.1.1) port 55069
* Connected to 192.168.1.1 (192.168.1.1) port 21 (#0)
 TYPE I
 200 Switching to Binary mode.
 STOR 27.09.24-04:54:35:450817107-2.bz2
 150 Ok to send data.
} [298 bytes data]
* We are completely uploaded and fine
* Remembering we are in dir ""
 226 Transfer complete.
100   298    0     0  100   298      0   6002 --:--:-- --:--:-- --:--:--  6081
* Connection #0 to host 192.168.1.1 left intact
*   Trying 192.168.1.1:21...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 192.168.1.1 (192.168.1.1) port 21 (#0)
 220 (vsFTPd 3.0.5)
 USER admin
 331 Please specify the password.
 PASS admin
 230 Login successful.
 PWD
 257 "/mnt/bzip2" is the current directory
* Entry path is '/mnt/bzip2'
* Request has same path as previous transfer
 EPSV
* Connect data stream passively
* ftp_perform ends with SECONDARY: 0
 229 Entering Extended Passive Mode (|||57088|)
*   Trying 192.168.1.1:57088...
* Connecting to 192.168.1.1 (192.168.1.1) port 57088
* Connected to 192.168.1.1 (192.168.1.1) port 21 (#0)
 TYPE I
 200 Switching to Binary mode.
 STOR 27.09.24-04:54:35:753758153-3.bz2
 150 Ok to send data.
} [293 bytes data]
* We are completely uploaded and fine
* Remembering we are in dir ""
 226 Transfer complete.
100   293    0     0  100   293      0   6038 --:--:-- --:--:-- --:--:--  6104
* Connection #0 to host 192.168.1.1 left intact
*   Trying 192.168.1.1:21...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 192.168.1.1 (192.168.1.1) port 21 (#0)
 220 (vsFTPd 3.0.5)
 USER admin
 331 Please specify the password.
 PASS admin
 230 Login successful.
 PWD
 257 "/mnt/bzip2" is the current directory
* Entry path is '/mnt/bzip2'
* Request has same path as previous transfer
 EPSV
* Connect data stream passively
* ftp_perform ends with SECONDARY: 0
 229 Entering Extended Passive Mode (|||11228|)
*   Trying 192.168.1.1:11228...
* Connecting to 192.168.1.1 (192.168.1.1) port 11228
* Connected to 192.168.1.1 (192.168.1.1) port 21 (#0)
 TYPE I
 200 Switching to Binary mode.
 STOR 27.09.24-04:54:36:059326816-4.bz2
 150 Ok to send data.
} [290 bytes data]
* We are completely uploaded and fine
* Remembering we are in dir ""
 226 Transfer complete.
100   290    0     0  100   290      0   6579 --:--:-- --:--:-- --:--:--  6744
* Connection #0 to host 192.168.1.1 left intact
*   Trying 192.168.1.1:21...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 192.168.1.1 (192.168.1.1) port 21 (#0)
 220 (vsFTPd 3.0.5)
 USER admin
 331 Please specify the password.
 PASS admin
 230 Login successful.
 PWD
 257 "/mnt/bzip2" is the current directory
* Entry path is '/mnt/bzip2'
* Request has same path as previous transfer
 EPSV
* Connect data stream passively
* ftp_perform ends with SECONDARY: 0
 229 Entering Extended Passive Mode (|||10895|)
*   Trying 192.168.1.1:10895...
* Connecting to 192.168.1.1 (192.168.1.1) port 10895
* Connected to 192.168.1.1 (192.168.1.1) port 21 (#0)
 TYPE I
 200 Switching to Binary mode.
 STOR 27.09.24-04:54:36:368893258-5.bz2
 150 Ok to send data.
} [295 bytes data]
* We are completely uploaded and fine
* Remembering we are in dir ""
 226 Transfer complete.
100   295    0     0  100   295      0   6631 --:--:-- --:--:-- --:--:--  6704
* Connection #0 to host 192.168.1.1 left intact
^C

Ответ на: комментарий от slowpony

В чем вопрос и где команда?

что пишут в curl что бы процесс не висел?

команда

#!/bin/bash 

# Это функция, которая делает «типа, записал»
tipa_write() {
    touch $1
    while [ "$(wc -c < $1 )" -lt $MAX_FILESIZE ]; do 
    TDATE=`date +%x-%R:%S:%N`
        echo -e "Набор слов $TDATE" >> $1
        # тут логика твоего типазаписала
    done
}

# Это цикл, который делает «записал, сжал, удалил для $NUMBER_OF_FILES файлов
# с именами по номерам (в примере — от 1 до 100)
for FILENUM in $(seq $NUMBER_OF_FILES); do
    DATE=`date +%x-%R:%S:%N`
    # пишем
    tipa_write "$DOME/$FILE/$DATE-$FILENUM"
    # жмём
    bzip2 "$DOME/$FILE/$DATE-$FILENUM" 
    # удаляем непожатое
    rm -f "$DOME/$FILE/$DATE-$FILENUM"  
    # Копируем на USB   
    curl -v -u "admin:admin" "ftp://192.168.1.1" -T "$DOME/$FILE/$DATE-$FILENUM"* 
    # удаляем пожатое с локалки
    rm -f "$DOME/$FILE/$DATE-$FILENUM"*   
    # Пишем количество пожатых файлов
    echo $DATE-$FILENUM >> "$DOME/$FILE/filenum.txt" 
done
zte
() автор топика
Ответ на: комментарий от zte

а мож не курл висит ??
сразу после курла echo "курл выключился с $? " ??

скрипт укуренный по самое не балуйся, то бзипом играемся, то курлом куда-то обращаемся…

pfg ★★★★★
()
Ответ на: комментарий от unDEFER

Вывода много, судя по всему он просто качает файл за файлом и вы просто не дожидаетесь закачивания всех файлов.

нет, просто команда не выходит из uploud

zte
() автор топика