diff options
| author | somebodywashere <68244480+somebodywashere@users.noreply.github.com> | 2024-02-21 11:30:28 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-21 11:30:28 +0300 |
| commit | c61575ac9aca81b9b17fbcdb9f8a66195466abab (patch) | |
| tree | e1304ab7ab63bcdde4113f450b2f45e57f140c91 /web/job | |
| parent | f8796386dc3f96248d0115f60465456613008ec7 (diff) | |
Create directory for IPLimit files if needed (#1852)
Diffstat (limited to 'web/job')
| -rw-r--r-- | web/job/check_client_ip_job.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/web/job/check_client_ip_job.go b/web/job/check_client_ip_job.go index d48bc8eb..0d46249d 100644 --- a/web/job/check_client_ip_job.go +++ b/web/job/check_client_ip_job.go @@ -14,6 +14,7 @@ import ( "x-ui/database" "x-ui/database/model" + "x-ui/config" "x-ui/logger" "x-ui/xray" ) @@ -38,8 +39,10 @@ func NewCheckClientIpJob() *CheckClientIpJob { func (j *CheckClientIpJob) Run() { - // create files required for iplimit if not exists + // create files and dirs required for iplimit if not exists for i := 0; i < len(ipFiles); i++ { + err := os.MkdirAll(config.GetLogFolder(), 0770) + j.checkError(err) file, err := os.OpenFile(ipFiles[i], os.O_CREATE|os.O_APPEND|os.O_RDWR, 0644) j.checkError(err) defer file.Close() |
