Top

cron-config.git

Unnamed repository; edit this file 'description' to name the repository.

Clone   Log   Files   Readme

Archives:

zip   older archives

Branches:

* master

Releases:


Clone:

git clone ssh://git@gitlab.com:joedoe47/cron-config.git
git clone git://git.joepcs.com/projects/cron-config.git

Log:

DateAuthor (GPG Key)CommitComment
2020-05-26joedoe47 (54645C2F669F1189)cc7132ekey change
2020-01-07joedoe47 (D7D9DC93B1538725)4d99883autosync
2018-07-24joedoe47 (D7D9DC93B1538725)058766dgit-annex in joedoe47@greatfox-lylat2:/media/sdi1/documents/public/cron-config
2018-03-23joedoe47 (D7D9DC93B1538725)a0ad20bupdate commets and remove unecessary code
2018-03-23joedoe47 (D7D9DC93B1538725)f9e05d7git-annex in joedoe47@greatfox-lylat2:/media/sdi1/documents/public/cron-config

File Tree

  • README.md
  • install-cron

Readme

Cron Config

Allows delayed remote management of machines via git and crontab

Scenario

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.

I know there are other more powerful programs such as welder, pupy or ansible but I wanted to give a crack at rolling my own bare bone method.

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.

How to install

$ git clone git@git.joepcs.com: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)

How it works

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)

Default Layout/Structure

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

Updated Wed 10 Jun 2020 09:25:50 PM UTC. Back to top

© 2017-2018 Git · Privacy