Page 1 of 1

MySQL Befehlsfrage

Posted: 2004-03-13 14:50
by recoilmaster
Hi !

Ich hab mir ein kleines Script gebastellt um täglich 4 Werte in meiner MySQL DB upzudaten. Allerdings nimmer sie nicht richtig an.

Das Script sieht wie folgt aus.

Code: Select all

mysql -p*****
USE confixx; 
UPDATE kunden SET quota=1; 
UPDATE ftp SET quota=1; 
UPDATE pop3 SET quota=1; 
UPDATE allgemein SET quota=1;
quit
es ist eine Datei die täglich per Cron Job ausgeführt wird.

Ich bekomme allerdings imemr folgende Fehler.

Code: Select all

./quota: line 3: USE: command not found
./quota: line 4: UPDATE: command not found
./quota: line 5: UPDATE: command not found
./quota: line 6: UPDATE: command not found
./quota: line 7: UPDATE: command not found
./quota: line 9: quit: command not found
in die Mysql Console kommt er rein, dann ist aber Schluss.

Weiss einer was ich falsch gemacht habe ?

Danke

Bye Nils

Re: MySQL Befehlsfrage

Posted: 2004-03-13 14:59
by oxygen

Code: Select all

echo "USE confixx;n UPDATE kunden SET quota=1;n UPDATE ftp SET quota=1;n UPDATE pop3 SET quota=1;n 
UPDATE allgemein SET quota=1;" | mysql -p
(eine zeile)

Re: MySQL Befehlsfrage

Posted: 2004-03-13 15:02
by recoilmaster
Danke

Re: MySQL Befehlsfrage

Posted: 2004-03-13 15:04
by recoilmaster
hmmm

Code: Select all

PAGER set to stdout
PAGER set to stdout
PAGER set to stdout
PAGER set to stdout


ändert nix *_*

Re: MySQL Befehlsfrage

Posted: 2004-03-14 00:41
by boozedǃ
Ich würde es so machen:

Code: Select all

echo "UPDATE kunden SET quota=1;" >/tmp/quota.sql
echo "UPDATE ftp SET quota=1; >>/tmp/quota.sql
echo "UPDATE pop3 SET quota=1; >>/tmp/quota.sql
echo "UPDATE allgemein SET quota=1;" >>/tmp/quota.sql
mysql -pxxxxxxx confixx < /tmp/quota.sql
rm /tmp/quota.sql
Alternativ kann man ja den SQL Query auch direkt in die quota.sql schreiben, anstatt sie immer anzulegen.

Re: MySQL Befehlsfrage

Posted: 2004-03-14 02:06
by recoilmaster
Danke.

Re: MySQL Befehlsfrage

Posted: 2004-03-14 02:06
by recoilmaster
Sorry, 2 mal geposted *_*