J'ai du supprimé une partie, j'ai corrigé, refais un essai pour voir
xataz wrote:J'ai du supprimé une partie, j'ai corrigé, refais un essai pour voir
Toujours la même erreur

EDIT : j'ai rajouté un fi à la fin (vu qu'il y a 2 if), je n'ai plus l'erreur, je vais attendre voir si ça fonctionne

details bash -x :
+ NAME=nomdufichier.mkv
+ FOLDER=nomdudossier
+ file nomdudossier/nomdufichier.mkv
+ grep directory
+ '[' 1 -eq 0 ']'
Rajoute juste après :
#!/bin/bash
Ceci :
set -xa
Ce qui donne en entier :
#!/bin/bash
set -xa

NAME=$1
FOLDER=$2

## Check if folder
file "$FOLDER/$NAME" | grep "directory" > /dev/null 2>&1
if [ $? -eq 0 ]; then
  FOLDER="$FOLDER"/"$NAME"
  NB_FILE=$(ls -1 "$FOLDER" | grep -Ev '.txt|.nfo|.md' | wc -l)

  if [ $NB_FILE -gt 1 ]; then
    TMP="/tmp/file.tmp"
    ls -1 | grep -Ev '.txt|.nfo|.md' > $TMP
    while read file; do
      plowup uptobox $FOLDER/$file &
    done < $TMP
  else
    FILE=$(ls $FOLDER)
    plowup uptobox $FOLDER/$FILE &
  fi

     
else
  FILE=$FOLDER/$NAME
  plowup uptobox $FILE &
fi

Et copie tous le résultat ici. Comme je dit j'ai pas testé le script, et j'ai pas la possibilité avant ce soir de tester.
J'ai rajouter un fi à la fin :
#!/bin/bash
set -xa
NAME=$1
FOLDER=$2

## Check if folder
file "$FOLDER/$NAME" | grep "directory" > /dev/null 2>&1
if [ $? -eq 0 ]; then
  FOLDER="$FOLDER"/"$NAME"
  NB_FILE=$(ls -1 "$FOLDER" | grep -Ev '.txt|.nfo|.md' | wc -l)

  if [ $NB_FILE -gt 1 ]; then
    TMP="/tmp/file.tmp"
    ls -1 | grep -Ev '.txt|.nfo|.md' > $TMP
    while read file; do
      plowup uptobox $FOLDER/$file &
    done < $TMP
  else
    FILE=$(ls $FOLDER)
    plowup uptobox $FOLDER/$FILE &
  fi

fi
Le bash-x donne :
+ set -xa
+ NAME= nomdufichier.mkv
+ FOLDER=nomdudossier
+ file nomdudossier/nomdufichier.mkv
+ grep directory
+ '[' 1 -eq 0 ']'
J'ai exécuté : /home/thibsa/script_send.sh nomdufilm.mkv /home/thibsa/torrents/nomdudossier :
+ NAME=nomdufilm.mkv
+ FOLDER=/home/thibsa/torrents/The.social.network.2010.VFF.720P.mHD.X264.AC3-ROMKENT
+ file /home/thibsa/torrents/nomdudossier/nomdufilm.mkv
+ grep directory
+ '[' 1 -eq 0 ']'
Mais toujours rien sur mon compte uptobox
Tu n'as pas copier le code que j'ai modifier, cela ne risque pas de fonctionner
xataz wrote:Tu n'as pas copier le code que j'ai modifier, cela ne risque pas de fonctionner
J'avais pas vu la modif, mais j'ai changé et ça marche !!! Un grand merci à toi

Maintenant je fais test le fait que ça marche en auto
A voir si ça marche pour toute les conditions, dans le cas de plusieurs fichiers dans un dossier par exemple (series ou film avec nfo par exemple).
Voir également si sa marche avec rtorrent aussi.
Le test marche très bien en root mais quand je ne le suis pas j'ai cette erreur :
Starting upload (uptobox): nomdudossier/nomdufichier.mkv
Destination file: nomdufichier.mkv
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1689M  100   154  100 1689M      8  96.2M  0:00:19  0:00:17  0:00:02 91.7M
parse_attr failed (sed): "/<[Ff][Oo][Rr][Mm]/ action="
Failed inside parse_form_action(), line 920, core.sh
Failed inside uptobox_upload(), line 293, uptobox.sh
Failed inside uptobox_upload() [1]
Vu que rutorrent n'a pas les droits de root, ça ne peut pas marcher, comment faire marché plowup sans les droits de root ?
Auckland wrote:comment faire marché plowup sans les droits de root ?
En utilisant sudo.

Il faudra auparavant editer le fichiers /etc/sudoers pour permettre a l'utilisateur rutorrent d'utiliser sudo sans mot de pass.

Attention a bien réfléchir aux problématiques de sécurité.. J'en vois beaucoup qui n'hésitent pas à filer leur droits root via sudo à leur serveur web : c'est dangereux et ca va a l'encontre de toute les best practices.
Auckland wrote:Le test marche très bien en root mais quand je ne le suis pas j'ai cette erreur :
Starting upload (uptobox): nomdudossier/nomdufichier.mkv
Destination file: nomdufichier.mkv
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1689M  100   154  100 1689M      8  96.2M  0:00:19  0:00:17  0:00:02 91.7M
parse_attr failed (sed): "/<[Ff][Oo][Rr][Mm]/ action="
Failed inside parse_form_action(), line 920, core.sh
Failed inside uptobox_upload(), line 293, uptobox.sh
Failed inside uptobox_upload() [1]
Vu que rutorrent n'a pas les droits de root, ça ne peut pas marcher, comment faire marché plowup sans les droits de root ?

Normalement devrais pas y avoir de soucis.
As tu fais un :
plowmod --install
Mais avec ton utilisateur, le même qui lance rtorrent ?
xataz wrote:
Auckland wrote:Le test marche très bien en root mais quand je ne le suis pas j'ai cette erreur :
Starting upload (uptobox): nomdudossier/nomdufichier.mkv
Destination file: nomdufichier.mkv
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1689M  100   154  100 1689M      8  96.2M  0:00:19  0:00:17  0:00:02 91.7M
parse_attr failed (sed): "/<[Ff][Oo][Rr][Mm]/ action="
Failed inside parse_form_action(), line 920, core.sh
Failed inside uptobox_upload(), line 293, uptobox.sh
Failed inside uptobox_upload() [1]
Vu que rutorrent n'a pas les droits de root, ça ne peut pas marcher, comment faire marché plowup sans les droits de root ?

Normalement devrais pas y avoir de soucis.
As tu fais un :
plowmod --install
Mais avec ton utilisateur, le même qui lance rtorrent ?
Je n'arrive pas à me connecter à mon terminal avec l'utilisateur qui gère rtorrent, il me sort cette erreur :
Could not chdir to home directory /home/thibsa: No such file or directory
/bin/bash: No such file or directory
Pourtant le dossier "/home/thibsa" existe bien

Par contre en sftp je peux me connecter avec les 2
Fait un :
ls -la /home/
et
ls -la /home/thibsa
Fait également un :
cat /etc/passwd
(T'inquiete pas, ton mot de passe n'est pas dans ce fichier ^^)
Je me connecte en tant que thibs

ls -la /home/ :
total 32
drwxr-xr-x  5 root  root    4096 Nov 19 14:16 .
drwxr-xr-x 22 root  root    4096 Nov 19 13:00 ..
drwx------  2 root  root   16384 Nov 19 12:56 lost+found
drwxr-xr-x  4 thibs thibs   4096 Dec  3 09:00 thibs
drwxr-xr-x  5 root  thibsa  4096 Nov 22 19:35 thibsa
ls -la /home/thibsa :
total 44
drwxr-xr-x  5 root   thibsa  4096 Nov 22 19:35 .
drwxr-xr-x  5 root   root    4096 Nov 19 14:16 ..
-rw-r--r--  1 root   root     787 Dec  2 14:00 .rtorrent.rc
drwxr-xr-x  2 thibsa thibsa 20480 Dec  3 11:03 .session
-rwxr-xr-x  1 root   root     681 Dec  3 10:21 script_send.sh
drwxr-xr-x 38 thibsa thibsa  4096 Dec  3 10:36 torrents
drwxr-xr-x  2 thibsa thibsa  4096 Nov 19 14:23 watch
cat /etc/passwd :
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
systemd-timesync:x:100:103:systemd Time Synchronization,,,:/run/systemd:/bin/false
systemd-network:x:101:104:systemd Network Management,,,:/run/systemd/netif:/bin/false
systemd-resolve:x:102:105:systemd Resolver,,,:/run/systemd/resolve:/bin/false
systemd-bus-proxy:x:103:106:systemd Bus Proxy,,,:/run/systemd:/bin/false
Debian-exim:x:104:109::/var/spool/exim4:/bin/false
messagebus:x:105:110::/var/run/dbus:/bin/false
statd:x:106:65534::/var/lib/nfs:/bin/false
sshd:x:107:65534::/var/run/sshd:/usr/sbin/nologin
bind:x:108:113::/var/cache/bind:/bin/false
ntpd:x:109:114::/var/run/openntpd:/bin/false
thibs:x:1000:1000:Thibs,,,:/home/thibs:/bin/bash
thibsa:x:1001:1001::/home/thibsa:/bin/bash
ntp:x:110:115::/home/ntp:/bin/false
munin:x:111:116:munin application user,,,:/var/lib/munin:/bin/false
nginx:x:112:117:nginx user,,,:/nonexistent:/bin/false
ftp:x:113:119:ftp daemon,,,:/srv/ftp:/bin/false
C'est quoi cet mani de toujours tous faire avec le root

Enfin bref, fait un :
chown -R thibsa:thibsa /home/thibsa
Et retente de te connecté en thibsa
xataz wrote:C'est quoi cet mani de toujours tous faire avec le root

Enfin bref, fait un :
chown -R thibsa:thibsa /home/thibsa
Et retente de te connecté en thibsa
packet_write_wait: Connection to IP: Broken pipe
C'est pas sur que ton utilisateur à le droit de se connecter en ssh.

Connecte toi comme d'hab et fait un :
su - thibsa
xataz wrote:C'est pas sur que ton utilisateur à le droit de se connecter en ssh.

Connecte toi comme d'hab et fait un :
su - thibsa
Je me suis connecté et j'ai installé plowmod pour thibsa maintenant je vais faire un test avec un torrent


EDIT: ça marche !!!! Bien le merci mec !!!
Encore merci xatax pour ton aide précieuse

J'aurais une dernière question, est il possible de modifié le nom de "destination" (faire un équivalent à preg_replace en php), pense que avec grep ça peut être possible mais je n'ai pas compris comment l'utiliser

Le but est de passer de nomdufichier.avi à nomdufichier-pseudo.avi

et ensuite executer plowup uptobox $FOLDER/$file:$newname &
Oui c'est possible, exemple :
Mon nom de fichier de test :
# TEST=test.1.2.3.4.ext
Pour affiché l'extension :
# echo ${TEST##*.}
ext
Pour le nom de fichier :
# echo ${TEST%.*}
test.1.2.3.4
Pour mixé le tous :
# echo ${TEST%.*}-${USER}.${TEST##*.}
test.1.2.3.4-xataz.ext


Ce qui donnerais pour le code complet (Pas tester, mais normalement c'est bon) :
#!/bin/bash

NAME=$1
FOLDER=$2

## Check if folder
file "$FOLDER/$NAME" | grep "directory" > /dev/null 2>&1
if [ $? -eq 0 ]; then
  FOLDER="$FOLDER"/"$NAME"
  NB_FILE=$(ls -1 "$FOLDER" | grep -Ev '.txt|.nfo|.md' | wc -l)

  if [ $NB_FILE -gt 1 ]; then
    TMP="/tmp/file.tmp"
    ls -1 | grep -Ev '.txt|.nfo|.md' > $TMP
    while read FILE; do
      plowup uptobox $FOLDER/$FILE:${FILE%.*}-${USER}.${FILE##*.} &
    done < $TMP
  else
    FILE=$(ls -1 "$FOLDER" | grep -Ev '.txt|.nfo|.md')
    plowup uptobox $FOLDER/$FILE:${FILE%.*}-${USER}.${FILE##*.} &
  fi

     
else
  FILE=$NAME
  plowup uptobox $FOLDER/$FILE:${FILE%.*}-${USER}.${FILE##*.} &
fi
J'ai ajouté USER="monpseudo" en dessous de FOLDER=$2 afin de pefinir USER et c'est bon ça marche nickel

Merci bien !

EDIT: ca ne marche pas pour les fichiers qui sont dans un dossier automatiquement mais en manuel ça marche quand je fais :
/home/thibsa/script_send.sh monfilmdevacance.mkv /home/thibsa/torrents/dossierdevacance
Voici un bash -x de l'opération en manu :
/home/thibsa/script_send.sh monfilmdevacance.mkv /home/thibsa/torrents/dossierdevacance
+ set -xa
+ NAME= monfilmdevacance.mkv
+ FOLDER=/home/thibsa/torrents/dossierdevacance
+ USER=monpseudo
+ file /home/thibsa/torrents/dossierdevacance/monfilmdevacance.mkv
+ grep directory
+ '[' 1 -eq 0 ']'
+ FILE= monfilmdevacance.mkv
+ plowup uptobox /home/thibsa/torrents/dossierdevacance/monfilmdevacance.mkv: monfilmdevacance-monpseudo.mkv
root@sd-78800:/home/thibsa/torrents# uptobox: take --auth option from configuration file
Starting upload (uptobox): /home/thibsa/torrents/dossierdevacance/monfilmdevacance.mkv
Destination file: monfilmdevacance-monpseudo.mkv
Starting login process: ********/********
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 4051M    0   304  100 4051M      4  57.2M  0:01:10  0:01:10 --:--:--     0
N'y a t'il pas moyen de voir les données qu'envoi rtorrent au script, savoir s'il il y a bien la même architecture pour le dossier