我安装了HANDLE hConnect = ::InternetOpen( TEXT("FCM"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 );
if( hConnect == NULL )
return false;
HANDLE hHttp = ::InternetConnect( hConnect, TEXT("fcm.googleapis.com"), INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, NULL );
if( hHttp == NULL )
{
InternetCloseHandle( hConnect );
return false;
}
HANDLE hReq = HttpOpenRequest(hHttp, TEXT("POST"), TEXT("/fcm/send"), HTTP_VERSION, NULL, 0, INTERNET_FLAG_RELOAD | INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_NO_COOKIES, 0 );
if( hReq == NULL )
{
InternetCloseHandle( hConnect );
InternetCloseHandle( hHttp );
return false;
}
TCHAR szHeader[1024] = { 0, }, szTmp[1024] = { 0, };
_stprintf( szTmp, TEXT("Content-Type:application/json\r\n") );
_tcscat( szHeader, szTmp );
_stprintf( szTmp, TEXT("Authorization:key=%s\r\n"), TEXT("Server key") );
_tcscat( szHeader, szTmp );
_tcscat( szHeader, TEXT("\r\n\r\n") );
作为Windows服务。我的代码将* .pid和Celery日志文件移动到另一个目录,但是三个文件(./gradlew tasks --offline
,Celery
,celerybeat-schedule.bak
)无法移动。
我使用下面的代码来更改其他文件的默认路径:
celerybeat-schedule.dir
如何更改Celery Beat Service的默认路径?
答案 0 :(得分:5)
最后,我可以使用以下代码更改芹菜服务的路径。
command = '"{celery_path}" -A {proj_dir} beat -f "{log_path}" -l info --pidfile="{pid_path}" '.format(
celery_path=os.path.join(PYTHONSCRIPTPATH, 'celery.exe'),
proj_dir=PROJECTDIR,
# log_path_1=os.path.join(INSTDIR,'celery_2.log')),
log_path=os.path.join(CELERYDIR,'celery_'+cur_date_time+'.log'),
# bak_path=os.path.join(CELERYDIR,'celerybeat-schedule'),
pid_path = os.path.join(CELERYDIR,'celerybeat_'+cur_date_time+'.pid'))
答案 1 :(得分:3)
如果执行了User::insert(['id'=>2,'name'=>'overflow']);
,它将打印出非常有用的CLI帮助,您可以在其中找到问题的解决方案-celery -A your.project.app beat --help
标志。
-s <path to the scheduler database file>
您要做的就是将日程表数据库文件的完整路径传递给Celery beat进程。示例:-s SCHEDULE, --schedule SCHEDULE
Path to the schedule database. Defaults to celerybeat-
schedule. The extension '.db' may be appended to the
filename. Default is celerybeat-schedule.