Update crontab_api.py

This commit is contained in:
midoks
2023-08-02 14:27:04 +08:00
parent f04c70f022
commit 1f7bd76875
+8 -5
View File
@@ -508,8 +508,7 @@ class crontab_api:
else:
head = "#!/bin/bash\nPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin\nexport PATH\n"
source_bin_activate = '''
export LANG=en_US.UTF-8
start_head = '''
SCRIPT_RUN_TIME="0s"
MW_ToSeconds()
{
@@ -523,12 +522,16 @@ MW_ToSeconds()
fi
}
START_MW_SHELL_TIME=`date +%s`
'''
source_bin_activate = '''
export LANG=en_US.UTF-8
MW_PATH=%s/bin/activate
if [ -f $MW_PATH ];then
source $MW_PATH
fi''' % (mw.getRunDir(),)
head = head + source_bin_activate + "\n"
head = head + start_head + source_bin_activate + "\n"
log = '.log'
script_dir = mw.getRunDir() + "/scripts"
@@ -570,8 +573,8 @@ fi''' % (mw.getRunDir(),)
shell += '''
echo "----------------------------------------------------------------------------"
endDate=`date +"%Y-%m-%d %H:%M:%S"`
END_MW_SHELL_TIME=`date +%s`
((SHELL_COS_TIME=(${END_MW_SHELL_TIME}-${START_MW_SHELL_TIME})))
END_MW_SHELL_TIME=`date +"%s"`
((SHELL_COS_TIME=($END_MW_SHELL_TIME-$START_MW_SHELL_TIME)))
MW_ToSeconds $SHELL_COS_TIME
echo "★[$endDate] Successful | Script Run [$SCRIPT_RUN_TIME] "
echo "----------------------------------------------------------------------------"