Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1114 connectés 

  FORUM HardWare.fr
  Linux et OS Alternatifs
  Codes et scripts

  [SCRIPT] divers problemes simples... [solutions trouvées]

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[SCRIPT] divers problemes simples... [solutions trouvées]

n°232598
raph93
Posté le 04-03-2003 à 15:26:44  profilanswer
 

/etc/init.d/mysqld stop >> /home/raph/uninstall.log
/etc/init.d/httpd stop >> /home/raph/uninstall.log
 
rm -rf /home/www/ >> /home/raph/uninstall.log
 
rpm -e php-mysql-4.0.6-7 >> /home/raph/uninstall.log
rpm -e MySQL-3.23.51-1 >> /home/raph/uninstall.log
rpm -e MySQL-shared-3.23.51-1 >> /home/raph/uninstall.log
rpm -e php-4.0.6-7 >> /home/raph/uninstall.log
rpm -e apache-1.3.22-6 >> /home/raph/uninstall.log
 
rm apache-1.3.22-6.i386.rpm >> /home/raph/uninstall.log
rm MySQL-3.23.51-1.i386.rpm >> /home/raph/uninstall.log
rm MySQL-shared-3.23.51-1.i386.rpm >> /home/raph/uninstall.log
rm php-4.0.6-7.i386.rpm >> /home/raph/uninstall.log
rm php-mysql-4.0.6-7.i386.rpm >> /home/raph/uninstall.log
rm phpMyAdmin-2.3.0-php.tar.gz >> /home/raph/uninstall.log


 
Ce script fonctionne correctement mais j'obtiens des erreurs bizarres...
 
1 ) Pourquoi j'obtiens des "Command not found" à la place des espaces(lors de l'execution du script) , quand je retire ces espaces je n'obtiens plus ces erreurs ??  :heink:  
 
2 ) Pourquoi le fichiers de log crée sur le disque s'appelle "uninstall.log?" et non pas "uninstall.log" ??
 
3 ) Pourquoi le fichier de log est vide apres l'execution du script ??
 
 
Merci de votre aide  :jap:  :jap:


Message édité par raph93 le 04-03-2003 à 18:07:50

---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
mood
Publicité
Posté le 04-03-2003 à 15:26:44  profilanswer
 

n°232599
kazekami
J'aime pas les gens
Posté le 04-03-2003 à 15:29:54  profilanswer
 

raph93 a écrit :


/etc/init.d/mysqld stop >> /home/raph/uninstall.log
/etc/init.d/httpd stop >> /home/raph/uninstall.log
 
rm -rf /home/www/ >> /home/raph/uninstall.log
 
rpm -e php-mysql-4.0.6-7 >> /home/raph/uninstall.log
rpm -e MySQL-3.23.51-1 >> /home/raph/uninstall.log
rpm -e MySQL-shared-3.23.51-1 >> /home/raph/uninstall.log
rpm -e php-4.0.6-7 >> /home/raph/uninstall.log
rpm -e apache-1.3.22-6 >> /home/raph/uninstall.log
 
rm apache-1.3.22-6.i386.rpm >> /home/raph/uninstall.log
rm MySQL-3.23.51-1.i386.rpm >> /home/raph/uninstall.log
rm MySQL-shared-3.23.51-1.i386.rpm >> /home/raph/uninstall.log
rm php-4.0.6-7.i386.rpm >> /home/raph/uninstall.log
rm php-mysql-4.0.6-7.i386.rpm >> /home/raph/uninstall.log
rm phpMyAdmin-2.3.0-php.tar.gz >> /home/raph/uninstall.log


 
Ce script fonctionne correctement mais j'obtiens des erreurs bizarres...
 
1 ) Pourquoi j'obtiens des "Command not found" à la place des espaces(lors de l'execution du script) , quand je retire ces espaces je n'obtiens plus ces erreurs ??  :heink:  
 
2 ) Pourquoi le fichiers de log crée sur le disque s'appelle uninstall.log? et non pas "uninstall.log" ??
 
3 ) Pourquoi le fichier de log est vide apres l'execution du script ??
 
 
Merci de votre aide  :jap:  :jap:


 
1) tu as bien mis un " #! /bin/sh" ou un " #! /bin/bash" au debut de ton script ?
 
2) j'ai pas compris  :heink:  
 
3) paske les commandes ne sont pas trouvées ?


---------------
Self Destruction Might Be The Answer - http://www.kazekami.org
n°232601
raph93
Posté le 04-03-2003 à 15:30:47  profilanswer
 

KazeKami a écrit :


 
1) tu as bien mis un " #! /bin/sh" ou un " #! /bin/bash" au debut de ton script ?
 
2) j'ai pas compris  :heink:  
 
3) paske les commandes ne sont pas trouvées ?


 
1) non , je vais le rajouter


---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
n°232602
kazekami
J'aime pas les gens
Posté le 04-03-2003 à 15:31:36  profilanswer
 

raph93 a écrit :


 
1) non , je vais le rajouter  


 
je pense ke ca venait de la... paske j'ai fait le meme oubli l'autre soir :D


---------------
Self Destruction Might Be The Answer - http://www.kazekami.org
n°232603
raph93
Posté le 04-03-2003 à 15:32:41  profilanswer
 

en rajoutant #! /bin/bash au debut du script j'obtiens :
 

[root@localhost raph]# ./uninstall.sh
bash: ./uninstall.sh: bad interpreter: No such file or directory



---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
n°232604
kazekami
J'aime pas les gens
Posté le 04-03-2003 à 15:33:50  profilanswer
 

raph93 a écrit :

en rajoutant #! /bin/bash au debut du script j'obtiens :
 

[root@localhost raph]# ./uninstall.sh
bash: ./uninstall.sh: bad interpreter: No such file or directory


 


 
tu ne dois pas avoir bash d'installé. test avec " #! /bin/sh "


Message édité par kazekami le 04-03-2003 à 15:34:01

---------------
Self Destruction Might Be The Answer - http://www.kazekami.org
n°232605
raph93
Posté le 04-03-2003 à 15:35:06  profilanswer
 

KazeKami a écrit :


 
tu ne dois pas avoir bash d'installé. test avec " #! /bin/sh "


 

[root@localhost raph]# rpm -qa |grep bash
bash-2.05-8


 
 :D  
 
ca fait parei avec /bin/sh  :(


---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
n°232606
HuGoBioS
Posté le 04-03-2003 à 15:36:58  profilanswer
 

c'est pas pluyoy #!/bin/bash ?


---------------
-= In Kik00 101 I trust :o =-
n°232607
kazekami
J'aime pas les gens
Posté le 04-03-2003 à 15:37:08  profilanswer
 

et avec :
 
#!/bin/bash
 
(cad sans espace entre ! et /) ?


---------------
Self Destruction Might Be The Answer - http://www.kazekami.org
n°232608
kazekami
J'aime pas les gens
Posté le 04-03-2003 à 15:37:46  profilanswer
 

HuGoBioS a écrit :

c'est pas pluyoy #!/bin/bash ?


 
grillaid :D
 
j'ai tapé un espace en trop, c couillon hin ? pour une fois ke j'pouvais aidé lol


---------------
Self Destruction Might Be The Answer - http://www.kazekami.org
mood
Publicité
Posté le 04-03-2003 à 15:37:46  profilanswer
 

n°232609
raph93
Posté le 04-03-2003 à 15:38:16  profilanswer
 

KazeKami a écrit :

et avec :
 
#!/bin/bash
 
(cad sans espace entre ! et /) ?


 
pareil  :heink:


---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
n°232610
Mjules
Modérateur
Parle dans le vide
Posté le 04-03-2003 à 15:40:04  profilanswer
 

il est bien éxécutable ton script ?

chmod a+x uninstall.sh


---------------
Celui qui pose une question est idiot 5 minutes. Celui qui n'en pose pas le reste toute sa vie. |  Membre du grand complot pharmaceutico-médico-scientifico-judéo-maçonnique.
n°232611
raph93
Posté le 04-03-2003 à 15:41:15  profilanswer
 

Mjules a écrit :

il est bien éxécutable ton script ?

chmod a+x uninstall.sh




 

[root@localhost raph]# ll
total 4
-rw-r--r--    1 root     root            0 Mar  4 15:10 uninstall.log?
-rwxrwxrwx    1 root     root          782 Mar  4 15:29 uninstall.sh


 
 :o


---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
n°232613
raph93
Posté le 04-03-2003 à 15:42:24  profilanswer
 

pour info : c'est une RedHat 7.2


---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
n°232617
kazekami
J'aime pas les gens
Posté le 04-03-2003 à 15:46:28  profilanswer
 

raph93 a écrit :

pour info : c'est une RedHat 7.2


 
je fais le meme genre de chose sur une redhat 7.3 :
 

Citation :

[nom]exemple[/nom]
 
#!/bin/sh
#
 
# on dumpe la base MySQL dans un fichier temporaire
mysqldump --opt -u $USER -p$PASS $BASE_SQL > $HOME/WEB-INF/tmp/ksupbase.sql


 


---------------
Self Destruction Might Be The Answer - http://www.kazekami.org
n°232618
raph93
Posté le 04-03-2003 à 15:49:36  profilanswer
 

KazeKami a écrit :


 
je fais le meme genre de chose sur une redhat 7.3 :
 

Citation :

[nom]exemple[/nom]
 
#!/bin/sh
#
 
# on dumpe la base MySQL dans un fichier temporaire
mysqldump --opt -u $USER -p$PASS $BASE_SQL > $HOME/WEB-INF/tmp/ksupbase.sql


 


 
tu peux tenter d'executer mon script sur ta machine histoire de voir ce ke ca donne
 
 :jap:  
 
 


Message édité par raph93 le 04-03-2003 à 15:49:52

---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
n°232623
HuGoBioS
Posté le 04-03-2003 à 15:58:23  profilanswer
 

KazeKami a écrit :


 
grillaid :D
 
j'ai tapé un espace en trop, c couillon hin ? pour une fois ke j'pouvais aidé lol

spagrave ca arrive !
 
mais c'est bizzare que meme sans espace ca marche pas !
 
Pour faire un script y'a deux trucs a respecter : le #!/bin/bash (donc la definition de l'interpreteur, ici bash)
et le chmod 777 (pour que tt le monde puisse le lancer)
 
apres c'est censé marcher a tt les coups !


---------------
-= In Kik00 101 I trust :o =-
n°232629
raph93
Posté le 04-03-2003 à 16:05:59  profilanswer
 

j'ai laisser un espace au debut du fichier avant #!/bin/bash maintenant ca marche par contre y'a toujours les problemes :
 
 
1 ) Pourquoi j'obtiens des "Command not found" à la place des espaces(lors de l'execution du script) , quand je retire ces espaces je n'obtiens plus ces erreurs ??  :heink:  
 
2 ) Pourquoi le fichiers de log crée sur le disque s'appelle "uninstall.log?" et non pas "uninstall.log" ??  
 
3 ) Pourquoi le fichier de log est vide apres l'execution du script ??


Message édité par raph93 le 04-03-2003 à 16:30:04

---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
n°232639
kazekami
J'aime pas les gens
Posté le 04-03-2003 à 16:21:33  profilanswer
 

raph93 a écrit :

j'ai laisser un espace au debut du fichier avant #!/bin/bash maintenant ca marche par contre y'a toujours les problemes :
 
 
1 ) Pourquoi j'obtiens des "Command not found" à la place des espaces(lors de l'execution du script) , quand je retire ces espaces je n'obtiens plus ces erreurs ??  :heink:  
 
2 ) Pourquoi le fichiers de log crée sur le disque s'appelle uninstall.log? et non pas "uninstall.log" ??  
 
3 ) Pourquoi le fichier de log est vide apres l'execution du script ??
 
 
 


 
pask'a mon idée on en revient au meme pb k'au debut, cad k'il ne trouve pas de shell pour executer ton script (on dirait ke le fait de laisser un espace devant #!/bin/bash fait ke cette ligne est ignorée  :heink: )


---------------
Self Destruction Might Be The Answer - http://www.kazekami.org
n°232640
raph93
Posté le 04-03-2003 à 16:22:47  profilanswer
 

KazeKami a écrit :


 
pask'a mon idée on en revient au meme pb k'au debut, cad k'il ne trouve pas de shell pour executer ton script (on dirait ke le fait de laisser un espace devant #!/bin/bash fait ke cette ligne est ignorée  :heink: )


 
ouais je vois cke tu veux dire, c chelou


---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
n°232650
raph93
Posté le 04-03-2003 à 16:47:04  profilanswer
 

c bon j'ai trouvé la solution au probleme de l'interpreteur...
 
en fait j'avais crée mon script avec Textpad sous Win (pas avec Vi) resultat le texte etait au format DOS  
 
je l'ai converti avec Dos2Unix , et maintenant c bon  
les question 1 & 2 sont resolus  
 
il reste à savoir :
 
3 ) Pourquoi le fichier de log est vide apres l'execution du script ??  
 
 :jap:  
 


---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
n°232653
HuGoBioS
Posté le 04-03-2003 à 16:53:19  profilanswer
 

fait un touch uninstall.log en premire ligne de script


---------------
-= In Kik00 101 I trust :o =-
n°232656
raph93
Posté le 04-03-2003 à 16:57:35  profilanswer
 

HuGoBioS a écrit :

fait un touch uninstall.log en premire ligne de script  


 
non ca marche pas


---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
n°232663
raph93
Posté le 04-03-2003 à 17:11:40  profilanswer
 

pour ce recentrer sur la question, on observe ceci :
 
le fichier est vide
 

[root@localhost raph]# /etc/init.d/mysqld stop > /home/raph/uninstall.log
bash: /etc/init.d/mysqld: No such file or directory
[root@localhost raph]# ll
total 4
-rw-r--r--    1 root     root            0 Mar  4 16:58 uninstall.log
-rwxrwxrwx    1 root     root          769 Mar  4 16:51 uninstall.sh


 
le fichier contient des données
 

[root@localhost raph]# ifconfig  > /home/raph/uninstall.log
[root@localhost raph]# ll
total 8
-rw-r--r--    1 root     root         1269 Mar  4 16:58 uninstall.log
-rwxrwxrwx    1 root     root          769 Mar  4 16:51 uninstall.sh


 


---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
n°232681
kazekami
J'aime pas les gens
Posté le 04-03-2003 à 17:38:08  profilanswer
 

sur la premiere ligne de ton script, remplace >> par > peut etre  :??:


---------------
Self Destruction Might Be The Answer - http://www.kazekami.org
n°232683
raph93
Posté le 04-03-2003 à 17:39:15  profilanswer
 

KazeKami a écrit :

sur la premiere ligne de ton script, remplace >> par > peut etre  :??:  


 
deja tenté , mais ca fait rien :/


---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
n°232684
kazekami
J'aime pas les gens
Posté le 04-03-2003 à 17:44:54  profilanswer
 

raph93 a écrit :


 
deja tenté , mais ca fait rien :/


 
oui, g vu apres ke HuGoBiOs t'avait proposé la solution du touch, ki revenait au meme
 
chez moi g tenté /etc/init.d/httpd restart >> /tmp/toto.log et ca marche
 
tu es root kan tu executes ce script ?


---------------
Self Destruction Might Be The Answer - http://www.kazekami.org
n°232687
minusplus
Posté le 04-03-2003 à 17:47:33  profilanswer
 

par défaut rm ne produit aucune sortie sur stdin.
rpm je sais pas.
il faut catcher aussi stdout :
 
commande  2>&1 >> fichier.log

n°232690
raph93
Posté le 04-03-2003 à 17:48:22  profilanswer
 

KazeKami a écrit :


 
oui, g vu apres ke HuGoBiOs t'avait proposé la solution du touch, ki revenait au meme
 
chez moi g tenté /etc/init.d/httpd restart >> /tmp/toto.log et ca marche
 
tu es root kan tu executes ce script ?


 
yep


---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
n°232699
raph93
Posté le 04-03-2003 à 18:07:00  profilanswer
 

minusplus a écrit :

par défaut rm ne produit aucune sortie sur stdin.
rpm je sais pas.
il faut catcher aussi stdout :
 
commande  2>&1 >> fichier.log


 
parfait ca marche nickel !
 
le script final (apres resolution des problemes)
 

#!/bin/bash
 
/etc/init.d/mysqld stop >> /home/raph/uninstall.log  2>&1
/etc/init.d/httpd stop >> /home/raph/uninstall.log  2>&1
 
rm -rf /home/www/ >> /home/raph/uninstall.log 2>&1
 
rpm -e php-mysql-4.0.6-7 >> /home/raph/uninstall.log 2>&1
rpm -e MySQL-3.23.51-1 >> /home/raph/uninstall.log 2>&1
rpm -e MySQL-shared-3.23.51-1 >> /home/raph/uninstall.log 2>&1
rpm -e php-4.0.6-7 >> /home/raph/uninstall.log 2>&1
rpm -e apache-1.3.22-6 >> /home/raph/uninstall.log 2>&1
 
rm apache-1.3.22-6.i386.rpm >> /home/raph/uninstall.log 2>&1
rm MySQL-3.23.51-1.i386.rpm >> /home/raph/uninstall.log 2>&1
rm MySQL-shared-3.23.51-1.i386.rpm >> /home/raph/uninstall.log 2>&1
rm php-4.0.6-7.i386.rpm >> /home/raph/uninstall.log 2>&1
rm php-mysql-4.0.6-7.i386.rpm >> /home/raph/uninstall.log 2>&1
rm phpMyAdmin-2.3.0-php.tar.gz >> /home/raph/uninstall.log 2>&1


 
Merci à tous !
 :jap:  


---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
n°232701
kazekami
J'aime pas les gens
Posté le 04-03-2003 à 18:10:20  profilanswer
 

raph93 a écrit :


 
parfait ca marche nickel !
 
le script final (apres resolution des problemes)
 
---
 
Merci à tous !
 :jap:  
 


 
je dirai ke pour /etc/init.d/* tu n'as pas besoin de 2>&1 , ni pour rpm -e


---------------
Self Destruction Might Be The Answer - http://www.kazekami.org
n°232703
raph93
Posté le 04-03-2003 à 18:12:45  profilanswer
 

KazeKami a écrit :


 
je dirai ke pour /etc/init.d/* tu n'as pas besoin de 2>&1 , ni pour rpm -e


 
ben si je recupere les eventuelles erreurs :
 

./uninstall.sh: /etc/init.d/mysqld: No such file or directory
./uninstall.sh: /etc/init.d/httpd: No such file or directory
error: package php-mysql-4.0.6-7 is not installed
error: package MySQL-3.23.51-1 is not installed
error: package MySQL-shared-3.23.51-1 is not installed
error: package php-4.0.6-7 is not installed
error: package apache-1.3.22-6 is not installed
rm: cannot remove `apache-1.3.22-6.i386.rpm': No such file or directory
rm: cannot remove `MySQL-3.23.51-1.i386.rpm': No such file or directory
rm: cannot remove `MySQL-shared-3.23.51-1.i386.rpm': No such file or directory
rm: cannot remove `php-4.0.6-7.i386.rpm': No such file or directory
rm: cannot remove `php-mysql-4.0.6-7.i386.rpm': No such file or directory
rm: cannot remove `phpMyAdmin-2.3.0-php.tar.gz': No such file or directory


---------------
Nothing can stop me, I'm never satisfied, I take what i want, refuse to be denied...
n°232707
kazekami
J'aime pas les gens
Posté le 04-03-2003 à 18:19:18  profilanswer
 

raph93 a écrit :


 
ben si je recupere les eventuelles erreurs :
 

./uninstall.sh: /etc/init.d/mysqld: No such file or directory
./uninstall.sh: /etc/init.d/httpd: No such file or directory
error: package php-mysql-4.0.6-7 is not installed
error: package MySQL-3.23.51-1 is not installed
error: package MySQL-shared-3.23.51-1 is not installed
error: package php-4.0.6-7 is not installed
error: package apache-1.3.22-6 is not installed
rm: cannot remove `apache-1.3.22-6.i386.rpm': No such file or directory
rm: cannot remove `MySQL-3.23.51-1.i386.rpm': No such file or directory
rm: cannot remove `MySQL-shared-3.23.51-1.i386.rpm': No such file or directory
rm: cannot remove `php-4.0.6-7.i386.rpm': No such file or directory
rm: cannot remove `php-mysql-4.0.6-7.i386.rpm': No such file or directory
rm: cannot remove `phpMyAdmin-2.3.0-php.tar.gz': No such file or directory




 
oui mais tu dois kan meme les recuperer dans ton fichier log meme si tu ne rediriges pas 2 sur 1 (j'ai testé de mon coté et ca marchait)


---------------
Self Destruction Might Be The Answer - http://www.kazekami.org
mood
Publicité
Posté le   profilanswer
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Linux et OS Alternatifs
  Codes et scripts

  [SCRIPT] divers problemes simples... [solutions trouvées]

 

Sujets relatifs
[BASH]découpage de script[SCRIPT] Creation d'un fichier log
Quelques problèmes avec ma nouvelle SidRedhat 8 et nfs : Y a t-il des problemes ?
Pb avec cronttab: script sh exécuté, pas php?Redhat 8 - des petits problemes -
Gros problèmes avec mes lecteurs CDprobleme curieux avec un script [RESOLU]
Toujours des problemes de lenteur 
Plus de sujets relatifs à : [SCRIPT] divers problemes simples... [solutions trouvées]


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR