lundi 29 décembre 2014

How to get a positive signal upon the successful completion of a command


For each of the following commands (four in total) I would like get an exception if one of them throws an exception if case of an error. Ultimately, I will run this through Python using os.system().



import os

x =\
"../../../mysql/bin/mysqldump\
--host=localhost\
--port=3306\
--databases ****\
--user=****\
--password=****\
--default-character-set=utf8\
--add-drop-database\
--add-drop-table\
--add-locks\
--complete-insert\
--extended-insert\
--lock-all-tables\
--create-options\
--disable-keys\
--quick\
--order-by-primary\
--set-charset\
--tz-utc\
> dump/test.sql;\
cd dump;\
tar -zcf test.sql.tar.gz test.sql;\
rm test.sql;"

os.system(x)


Any ideas?



Aucun commentaire:

Enregistrer un commentaire