move locks to locks directory
This commit is contained in:
parent
f923a77524
commit
fa4d495230
4 changed files with 15 additions and 4 deletions
|
|
@ -169,6 +169,10 @@ def make_site_dirs():
|
|||
site_public_path = os.path.join(frappe.local.site_path, 'public')
|
||||
for dir_path in (
|
||||
os.path.join(site_public_path, 'backups'),
|
||||
os.path.join(site_public_path, 'locks'),
|
||||
os.path.join(site_public_path, 'files')):
|
||||
if not os.path.exists(dir_path):
|
||||
os.makedirs(dir_path)
|
||||
locks_dir = frappe.get_site_path('locks')
|
||||
if not os.path.exists(locks_dir):
|
||||
os.makedirs(locks_dir)
|
||||
|
|
|
|||
|
|
@ -16,4 +16,5 @@ frappe.patches.4_0.website_sitemap_hierarchy
|
|||
frappe.patches.4_0.webnotes_to_frappe
|
||||
execute:frappe.reset_perms("Module Def")
|
||||
frappe.patches.4_0.rename_sitemap_to_route
|
||||
frappe.patches.4_0.set_website_route_idx
|
||||
frappe.patches.4_0.set_website_route_idx
|
||||
execute:import frappe.installer;frappe.installer.make_site_dirs() #2014-02-19
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import frappe
|
||||
from time import time
|
||||
from frappe.utils import get_site_path, touch_file
|
||||
|
||||
|
|
@ -34,5 +35,6 @@ def delete_lock(name):
|
|||
|
||||
def get_lock_path(name):
|
||||
name = name.lower()
|
||||
lock_path = get_site_path(name + '.lock')
|
||||
locks_dir = frappe.local.conf.locks_dir or 'locks'
|
||||
lock_path = get_site_path(locks_dir, name + '.lock')
|
||||
return lock_path
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ on the need.
|
|||
|
||||
import frappe
|
||||
import frappe.utils
|
||||
from frappe.utils.file_lock import create_lock, check_lock
|
||||
from frappe.utils.file_lock import create_lock, check_lock, delete_lock
|
||||
|
||||
def execute(site):
|
||||
"""
|
||||
|
|
@ -26,6 +26,10 @@ def execute(site):
|
|||
Database connection: Ideally it should be connected from outside, if there is
|
||||
no connection, it will connect from defs.py
|
||||
"""
|
||||
frappe.init(site=site)
|
||||
if check_lock('scheduler'):
|
||||
return
|
||||
create_lock('scheduler')
|
||||
from datetime import datetime
|
||||
|
||||
format = '%Y-%m-%d %H:%M:%S'
|
||||
|
|
@ -60,7 +64,7 @@ def execute(site):
|
|||
out.append(nowtime.strftime("%Y-%m-%d %H:%M:%S") + ' - hourly:' + trigger(site, 'hourly'))
|
||||
|
||||
out.append(nowtime.strftime("%Y-%m-%d %H:%M:%S") + ' - all:' + trigger(site, 'all'))
|
||||
|
||||
delete_lock('scheduler')
|
||||
return '\n'.join(out)
|
||||
|
||||
def trigger(site, event):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue