File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,14 @@ bool cPluginRestfulapi::Start(void)
134134
135135 FileCaches::get (); // cache files
136136
137+ string syncDir = Settings::get ()->CacheDirectory () + " /sync" ;
138+ FileExtension::get ()->exists (syncDir) || system ((" mkdir -p " + syncDir).c_str ());
139+ if (!FileExtension::get ()->exists (syncDir)) {
140+ esyslog (" restfulapi: error creating sync directory: %s" , syncDir.c_str ());
141+ } else {
142+ isyslog (" restfulapi: using sync directory: %s" , syncDir.c_str ());
143+ }
144+
137145 serverThread.Initialize ();
138146 serverThread.Start ();
139147 return true ;
@@ -151,16 +159,13 @@ void cPluginRestfulapi::Housekeeping(void)
151159{
152160 // Perform any cleanup or other regular tasks.
153161
154- // TODO: create sync dir if not exists
155-
156162 string cacheDir = Settings::get ()->CacheDirectory ();
157163 string syncDir = cacheDir + " /sync" ;
158164 string cmd = " find " + syncDir + " -type f -mtime +5 -delete" ;
159165 int result = system (cmd.c_str ());
160166 if (result > 0 ) {
161167 esyslog (" restfulapi: error cleaning up outdated syncfiles: %s" , cmd.c_str ());
162168 }
163- dsyslog (" restfulapi: cleaning up outdated syncfiles: %s" , cmd.c_str ());
164169}
165170
166171void cPluginRestfulapi::MainThreadHook (void )
You can’t perform that action at this time.
0 commit comments