Fix: test for python root
This commit is contained in:
@@ -0,0 +1,54 @@
|
|||||||
|
import sys
|
||||||
|
from datetime import datetime
|
||||||
|
import subprocess
|
||||||
|
from batch.unpaid_maestro_manager import UnpaidMaestroManager
|
||||||
|
|
||||||
|
|
||||||
|
print('# args : {}'.format(len(sys.argv)))
|
||||||
|
print('args : {}'.format(str(sys.argv)))
|
||||||
|
mode = 'mac'
|
||||||
|
arg_count = len(sys.argv)
|
||||||
|
if arg_count > 1:
|
||||||
|
mode = str(sys.argv[1]).lower();
|
||||||
|
|
||||||
|
|
||||||
|
def print_items(list):
|
||||||
|
for item in list:
|
||||||
|
print(item)
|
||||||
|
|
||||||
|
|
||||||
|
def backup_unregister_maestro_table_file():
|
||||||
|
space = ' '
|
||||||
|
command = 'mysqldump' + space
|
||||||
|
user = '-u root' + space
|
||||||
|
password = '-p52napark!' + space
|
||||||
|
transaction = '--single-transaction' + space
|
||||||
|
db = 'chocomae' + space
|
||||||
|
table = 'maestro' + space
|
||||||
|
where_clause = '--where="DATE(NOW()) - INTERVAL 7 DAY > AcceptClausesDateTime AND ActivateStatus = 0"' + space
|
||||||
|
output_directory = '/home/chocomae/unregister-user-backup/'
|
||||||
|
if mode == 'mac':
|
||||||
|
output_directory = ''
|
||||||
|
today = datetime.today().strftime('%Y%m%d-%H%M%S')
|
||||||
|
output_filename = '> ' + today + '.sql'
|
||||||
|
|
||||||
|
command_db_backup = command + user + password + transaction + db + table + where_clause \
|
||||||
|
+ output_directory + output_filename
|
||||||
|
# 'mysqldump -u "${DBUSER}" -p"${DBPASS}" --single-transaction "${DBNAME}" "${filename}" --where="DATE(${record_date})=CURDATE()" > "${filename}.dump.bydate.sql"'
|
||||||
|
print(command_db_backup)
|
||||||
|
# subprocess.call(command_db_backup)
|
||||||
|
|
||||||
|
|
||||||
|
unpaidMaestroMan = UnpaidMaestroManager(mode)
|
||||||
|
maestro_list = unpaidMaestroMan.get_unpaid_7days_maestro_list()
|
||||||
|
print_items(maestro_list)
|
||||||
|
|
||||||
|
backup_unregister_maestro_table_file()
|
||||||
|
|
||||||
|
# print(mode)
|
||||||
|
'''
|
||||||
|
for maestro in maestro_list:
|
||||||
|
remark = maestro['Name'] + ' / unpaid 7 days'
|
||||||
|
unpaidMaestroMan.insert_maestro_log(maestro['MaestroID'], remark)
|
||||||
|
unpaidMaestroMan.delete_maestro_list(maestro['MaestroID'])
|
||||||
|
'''
|
||||||
Reference in New Issue
Block a user