git clone ssh://email@example.com:joedoe47/cron-config.git
git clone git://git.joepcs.com/projects/cron-config.git
|Date||Author (GPG Key)||Commit||Comment|
|2020-05-26||joedoe47 (54645C2F669F1189)||cc7132e||key change|
|2018-07-24||joedoe47 (D7D9DC93B1538725)||058766d||git-annex in joedoe47@greatfox-lylat2:/media/sdi1/documents/public/cron-config|
|2018-03-23||joedoe47 (D7D9DC93B1538725)||a0ad20b||update commets and remove unecessary code|
|2018-03-23||joedoe47 (D7D9DC93B1538725)||f9e05d7||git-annex in joedoe47@greatfox-lylat2:/media/sdi1/documents/public/cron-config|
Allows delayed remote management of machines via git and crontab
This is particularly useful for me as I can do git push remotely to git/gitea and can tell server "X" to run a command once (by committing a script and making the script delete its self after running) of course you can also just edit cronjobs via git.
the idea was to run commands and be able to manage a few machines without having direct access to these server. I was and am willing to forgo instant execution in favor of indirect access.
This script is installed on a per user basis.
I would also suggest trying this with git-annex or git-lfs (some modification required for lfs) as these two also give you the ability to use larger files if need be.
this way I can even symlink certain configuration files from /etc/ to /home/user/config/HOST/config/nginx/nginx.conf and simple schedule a restart of it via cron.
there is no right or wrong way to use this. I just disliked all the confabulated playbook, roles, etc. a good portable script can run anywhere.
$ git clone firstname.lastname@example.org:joedoe47/cron-config.git $ bash install-cron install
to install it for root or another user $ su [user] # bash install-cron install
if you run it as root; it will allow you to manage the entire system remotely.
if you run it as a user; it will allow you to manage/run only what that user can do.
I feel the need to urge you to at least try and read this or understand what its doing. I do not run random scripts from the internet claiming to solve all my remote administration woes. (this is why I wrote my own)
Once installed the process it uses to be managed remotely is as follows
1- crontab runs for installed user
2- git pull from user specified 'origin'
3- install self updating crontab for $USER
4- repeat at 'n' time (every 5 minutes by default)
This is the basic default folder layout/structure it creates. I am intentionally leaving this a simple as possible because this might not scale well and also perhaps you or others might have a more efficient layout in mind for you scenario.
eg. logs should probably be stored in syslog or remote syslog server (but I am not because I want to manage every aspect of a few machines via git and solely git)
config ˪ hostname ˪ cron ˪ user.crontab ˪ tasks ˪ scripts ˪ config ˪ files ˪ log
hostname - the name of local machine
cron - list of cronjobs for 'user'
tasks - scripts or commands that run once but are time stammped and logged into log folder
scripts - any scripts host might need/use
config - any config files host might need/use
files - any files host may need