Fix: batch files to root directory
This commit is contained in:
@@ -30,10 +30,9 @@ def backup_unregister_maestro_table_file():
|
|||||||
if mode == 'mac':
|
if mode == 'mac':
|
||||||
output_directory = ''
|
output_directory = ''
|
||||||
today = datetime.today().strftime('%Y%m%d-%H%M%S')
|
today = datetime.today().strftime('%Y%m%d-%H%M%S')
|
||||||
output_filename = '> ' + today + '.sql'
|
output_filename = '> ' + output_directory + today + '.sql'
|
||||||
|
|
||||||
command_db_backup = command + user + password + transaction + db + table + where_clause \
|
command_db_backup = command + user + password + transaction + db + table + where_clause + output_filename
|
||||||
+ output_directory + output_filename
|
|
||||||
# 'mysqldump -u "${DBUSER}" -p"${DBPASS}" --single-transaction "${DBNAME}" "${filename}" --where="DATE(${record_date})=CURDATE()" > "${filename}.dump.bydate.sql"'
|
# 'mysqldump -u "${DBUSER}" -p"${DBPASS}" --single-transaction "${DBNAME}" "${filename}" --where="DATE(${record_date})=CURDATE()" > "${filename}.dump.bydate.sql"'
|
||||||
print(command_db_backup)
|
print(command_db_backup)
|
||||||
# subprocess.call(command_db_backup)
|
# subprocess.call(command_db_backup)
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
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'])
|
|
||||||
'''
|
|
||||||
@@ -1,12 +1,8 @@
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from lib.mail.module_b import ModuleB
|
|
||||||
|
|
||||||
print('path :')
|
print('path :')
|
||||||
path_list = sys.path
|
path_list = sys.path
|
||||||
print('path count : {}'.format(len(path_list)))
|
print('path count : {}'.format(len(path_list)))
|
||||||
for item in path_list:
|
for item in path_list:
|
||||||
print(item)
|
print(item)
|
||||||
|
|
||||||
mb = ModuleB()
|
|
||||||
mb.print()
|
|
||||||
Reference in New Issue
Block a user