Git Product home page Git Product logo

adl's Introduction

Overview

adl (which stands for "admin log") is a tool for recording the commands you type on the command line while administering your computer.

So for example, when you install a package or edit a config file, you can use adl to keep a track of the changes you've made.

Your actions are logged to /root/LOG, in the form of a shell script. This makes it very easy to:

  • repeat all these commands if you later need to re-install your computer (by running sh LOG), and
  • remind yourself how you installed or configured something.

See the announcement for more details.

Installation

Move the adl script to somewhere in your $PATH, and make sure it's executable. For example, you might choose to put it in /usr/local/bin:

$ sudo cp adl /usr/local/bin/
$ sudo chmod +x /usr/local/bin/adl

Usage

To record a command in the LOG file, prefix it with adl. The command you type will be executed, and then recorded in the log.

So to give you an example, on a Debian-based computer, this command would install the ssh package, and append 'apt-get install ssh' to the LOG file:

# adl apt-get install ssh

You can add block comments to document a group of commands with the -C switch:

# adl -C "Installing and configuring Apache"

If you want to record a change to a config file, use the -e switch to open it in your editor:

# adl -e /etc/hosts

When you save the file and quit your editor, adl will record the change you made in a manner that can be repeated automatically with the patch command.

Imagine that you've just used adl to edit the /etc/hosts file, adding the IP address for a computer called "batman". The text that's written to the LOG file when you quit your editor might look like this:

patch /etc/hosts <<'EOPATCH'
--- /etc/hosts.orig	2017-10-03 21:49:49.143301665 +0100
+++ /etc/hosts	2017-10-03 21:50:00.663741961 +0100
@@ -1,6 +1,8 @@
 127.0.0.1	localhost
 127.0.1.1	robin.lan	robin
 
+192.168.1.2	batman.lan	batman
+
 # The following lines are desirable for IPv6 capable hosts
 ::1     localhost ip6-localhost ip6-loopback
 ff02::1 ip6-allnodes
EOPATCH

If we later wanted to repeat that edit for some reason, we could execute the above code as part of a script, and it would take care of it for us.

That's pretty much it. adl records your system administration commands, as you execute them, in a manner that allows you to just execute them all again later.

It's basic, yet powerful. I often find myself referring to the LOG file simply to remind myself how I achieved something, and to provide me with a boiler plate for reproducing it on other computers.

adl's People

Contributors

gma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

cider-load-test

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.