Sziasztok,
egy idegesito hibaval szivok par napok ota, szejjel turtam a google-t soksok verziot kiprobaltam megse megy a mysqldump-om crontabbol. Ha a parancsot pontosan ugyanugy futattom parancssorbol, priman mukodik. Ha a crontabbol, a backup konyvtarba tesztkent, egy rm -rf /backup/* lefutottok priman mukodik.
A mysqldump a cronbol azonban nem. Cron log latja elvileg el is inditja (CMD) de SEMMI sem tortenik, se hiba uzi sesemmi.
crontab -l
48 14 * * * /usr/bin/mysqldump -uroot -pxxx --opt mingle -c | /bin/gzip -9 > /backup/mingle_$(date '+%Y%m%d').sql.gz
a cronlog pedig:
Mar 8 14:48:01 Tools1 crond[25585]: (root) CMD (/usr/bin/mysqldump -uroot -pxxxx --opt mingle -c | /bin/gzip -9 > /backup/mingle_$(date '+)
megis mi baja lehet? miert nem megy? merre nezzek korul meg?
koszi elore is
jack
- 1180 megtekintés
Hozzászólások
probald 2 % jellel:
48 14 * * * /usr/bin/mysqldump -uroot -pxxx --opt mingle -c | /bin/gzip -9 > /backup/mingle_$(date '+%%Y%%m%%d').sql.gz
vagy igy:
48 14 * * * /usr/bin/mysqldump -uroot -pxxx --opt mingle -c | /bin/gzip -9 > /backup/mingle_$(date '+\%Y\%m\%d').sql.gz
- A hozzászóláshoz be kell jelentkezni
koszi a tippet, de ezt azer nem hiszem, hogy mivel wildcardozas es gzippeles nelkul se fut: mysql dump -uroot -pxxx mingle >/backup/test.sql
- A hozzászóláshoz be kell jelentkezni
ha a mysqldump-ot 2 szoval irtad akkor valoban nem ;)
- A hozzászóláshoz be kell jelentkezni
ja bocs, az most irtam el.
- A hozzászóláshoz be kell jelentkezni
Bocs mindenki, mar meg is oldodott kozben:))
szkriptbe berakom, akkor megy.. mondjuk azert erdekelne, miert igy van?
- A hozzászóláshoz be kell jelentkezni
selinux esetleg? A "date" parancs nelkul mennie kellene.
Szerk:
a date paranccsal a cron kimenete /igy mar megfejtheto :)/:
/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
- A hozzászóláshoz be kell jelentkezni
Szerintem is a szazalekjelek miatt nem ment, de nem duplazva kell escapelni, hanem backslash-sel, lasd
man 5 crontab
(Vixie cron):
The ``sixth'' field (the rest of the line) specifies the command to be run. The entire command portion of the line, up to a newline or % character, will be executed by /bin/sh or by the shell specified in the SHELL variable of the crontab file. Percent-signs (%) in the command, unless escaped with backslash (\), will be changed into newline characters, and all data after the first % will be sent to the command as standard input. There is no way to split a single command line onto multiple lines, like the shell's trailing "\".
- A hozzászóláshoz be kell jelentkezni