30 7 * * 1-5
这是每周一,周二,周三,周四,周五早上7:30.
M.
解决方法 对于那些希望实现与@ScaryAardvark相同目标的人相关性:
http://cron.sourcearchive.com/downloads/3.0pl1/cron_3.0pl1.orig.tar.gz
建立:
gcc -o main main.c cron-3.0pl1.orig/entry.c cron-3.0pl1.orig/env.c
cron-3.0pl1.orig/misc.c -I cron-3.0pl1.orig
资源:
#include <pwd.h>#include <stdio.h>#include <errno.h>#include <string.h>#include <sys/types.h>#include <uuID/uuID.h>#define MAIN_PROGRAM 1#include "cron-3.0pl1.orig/cron.h"voID error_handler( char* message ){ fprintf( stderr,"Error: %s\n",message );}voID print_entry( const entry* e ){ fprintf( stdout,"uID: %i\n",e->uID ); fprintf( stdout,"gID: %i\n",e->gID ); fprintf( stdout,"command: %s\n",e->cmd); //etc...}int main( int argc,char** argv,char** envp ){ const char* filename = "crontab"; const char* username = "bcrowhurst"; //Retreive Crontab file file *file = fopen( filename,"r" ); if ( file == NulL ) { error_handler( strerror( errno ) ); return EXIT_FAILURE; } //Retreive Password Entry struct passwd *pw = getpwnam( username ); if ( pw == NulL ) { error_handler( strerror( errno ) ); return EXIT_FAILURE; } //Read Entry entry *e = load_entry( file,&error_handler,pw,envp ); if ( e == NulL ) { error_handler( "No entry found!" ); return EXIT_FAILURE; } print_entry( e ); //Clean-up fclose( file ); free_entry( e ); return EXIT_SUCCESS;}
示例Crontab
总结@yearly /home/bcrowhurst/annual-process
*/10 * * * * /home/bcrowhurst/fschk
以上是内存溢出为你收集整理的用于解码cron式时序的C/C++ API全部内容,希望文章能够帮你解决用于解码cron式时序的C/C++ API所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)