mirror of https://github.com/dnomd343/ClearDNS
Dnomd343
2 years ago
8 changed files with 47 additions and 71 deletions
@ -1,23 +1,42 @@ |
|||
#include <stdlib.h> |
|||
#include "process.h" |
|||
#include <signal.h> |
|||
#include "config.h" |
|||
#include "logger.h" |
|||
#include "sundry.h" |
|||
#include "system.h" |
|||
#include "process.h" |
|||
#include "structure.h" |
|||
|
|||
process* assets_load(assets_config *info) { // load assets update options
|
|||
log_info("assets test ok"); |
|||
char **update_file; |
|||
char **update_url; |
|||
|
|||
// TODO: update assets process
|
|||
// TODO: save cron exp in `/var/spool/cron/crontabs/root`
|
|||
void assets_update() { // update all assets
|
|||
log_info("Start assets update"); |
|||
for (char **file = update_file; *file != NULL; ++file) { |
|||
char **url = file - update_file + update_url; |
|||
log_info("Update asset `%s` -> %s", *file, *url); |
|||
} |
|||
} |
|||
|
|||
char *cron = string_join(info->cron, " kill -14 1"); |
|||
void assets_free(assets_config *info) { |
|||
string_list_free(info->update_file); |
|||
string_list_free(info->update_url); |
|||
free(info->cron); |
|||
free(info); |
|||
} |
|||
|
|||
log_info("Crontab exp -> `%s`", cron); |
|||
process* assets_load(assets_config *info) { // load assets update options
|
|||
update_url = string_list_init(); |
|||
update_file = string_list_init(); |
|||
string_list_update(&update_url, info->update_url); |
|||
string_list_update(&update_file, info->update_file); |
|||
signal(SIGALRM, assets_update); // receive SIGALRM signal
|
|||
|
|||
char *cron = string_join(info->cron, " kill -14 1"); |
|||
save_file("/var/spool/cron/crontabs/root", cron); |
|||
|
|||
free(cron); |
|||
|
|||
return process_init("Crontab", "crond"); |
|||
process *proc = process_init("Crontab", "crond"); |
|||
process_add_arg(proc, "-f"); // foreground
|
|||
return proc; |
|||
} |
|||
|
Loading…
Reference in new issue