-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
20e24bf
commit 45acf50
Showing
20 changed files
with
259 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
# TODOs | ||
|
||
- cleanup | ||
- allow user to interpolate a `RELATIVE_DIR` in crontabs (so they can reference files relative to the crontab) | ||
- allow variables in crontab | ||
- schedule and run overdue jobs | ||
- job reporting | ||
- synchronize updates to crontab | ||
- actually read the sys and user crontabs | ||
- perms | ||
- special crontab config support (toml or yaml?) | ||
- log to syslog | ||
- integ testing | ||
- unit tests | ||
- Ensure tests don't log to syslog or whatever (maybe a test sink?) | ||
- handle signals and log getting closed or deleted | ||
- [ ] cleanup | ||
- [ ] allow user to interpolate a `RELATIVE_DIR` in crontabs (so they can reference files relative to the crontab) | ||
- [x] allow variables in crontab | ||
- [ ] schedule and run overdue jobs | ||
- [ ] job reporting | ||
- [x] synchronize updates to crontab | ||
- [ ] actually read the sys ~~and user crontabs~~ | ||
- [ ] perms | ||
- [ ] special crontab config support (toml or yaml?) | ||
- [x] log to syslog | ||
- [ ] syslog levels? | ||
- [x] integ testing | ||
- [x] unit tests | ||
- [ ] Ensure tests don't log to syslog or whatever (maybe a test sink?) | ||
- [ ] handle signals and log getting closed or deleted | ||
- [ ] daemon lock | ||
- [ ] Allow log feature flags (fs logs, job logs, time logs, etc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
ROOT_DIR="$(dirname "$(readlink -f $BASH_SOURCE)")" | ||
SETUP_PATH="$ROOT_DIR/../t/integ/utils/setup.bash" | ||
|
||
. "$SETUP_PATH" | ||
uname_1='narcissus' | ||
uname_2='demian' | ||
uname_3='isao' | ||
|
||
setup_user_crondir | ||
|
||
setup_user $uname_1 | ||
setup_user $uname_2 | ||
|
||
setup_user_crontab $uname_3 | ||
|
||
add_user_job $uname_1 1 | ||
add_user_job $uname_2 1 | ||
add_user_job $uname_3 1 | ||
|
||
add_user_job $uname_1 3 | ||
add_user_job $uname_1 5 | ||
add_user_job $uname_2 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,36 @@ | ||
#ifndef DEFS_H | ||
#define DEFS_H | ||
#ifndef CONSTANTS_H | ||
#define CONSTANTS_H | ||
|
||
#include <fcntl.h> | ||
|
||
#include "libhash/libhash.h" | ||
#include "libutil/libutil.h" | ||
|
||
#ifndef SYS_CRONTABS_DIR | ||
#define SYS_CRONTABS_DIR "/etc/cron.d" | ||
#endif | ||
|
||
#ifndef CRONTABS_DIR | ||
#define CRONTABS_DIR "/var/spool/cron/crontabs" | ||
#endif | ||
|
||
#ifndef DEFAULT_PATH | ||
#define DEFAULT_PATH "/usr/bin:/bin:/usr/sbin:/sbin" | ||
#endif | ||
|
||
#define ROOT_UNAME "root" | ||
#define ROOT_UID 0 | ||
|
||
#define ALL_PERMS 07777 | ||
#define OWNER_RW_PERMS 0600 | ||
|
||
#define HOMEDIR_ENVVAR "HOME" | ||
#define SHELL_ENVVAR "SHELL" | ||
#define PATH_ENVVAR "PATH" | ||
#define UNAME_ENVVAR "USER" | ||
#define MAILTO_ENVVAR "MAILTO" | ||
|
||
#define SMALL_BUFFER 256 | ||
#define MED_BUFFER SMALL_BUFFER * 4 | ||
#define LARGE_BUFFER MED_BUFFER * 2 | ||
|
||
#define MAILCMD_FMT "%s -r%s@%s -s 'job: %s' %s" | ||
|
||
#define CHRONIC_VERSION "0.0.1" | ||
#define DAEMON_IDENT "crond" | ||
|
||
extern pid_t daemon_pid; | ||
extern const char *job_status_names[]; | ||
extern char hostname[SMALL_BUFFER]; | ||
|
||
extern array_t *job_queue; | ||
|
||
#endif /* DEFS_H */ | ||
extern const char *job_status_names[]; | ||
#endif /* CONSTANTS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.