I taught myself a thing today

My job was created as a response to communication issues between two different school district departments.  Basically, the curriculum department and the tech department needed a translator and someone to manage the systems that were solely the responsibility of the curriculum people (read: programs that were purchased to be integrated without understanding the work load or taking into account the capacity of the tech department).

I love my job.  I declared myself neutral territory and put up my own "flag" in my office.  I also get to learn about all the things.  Today, I learned about cron jobs.

Automated jobs and/or scheduled tasks are not an unfamiliar concept for me.  However, Linux is not something I've spent a lot of time with.  I do have administrator access to the server where we house all that automation, but "break everything" wasn't on my to-do list for today.  Instead, I installed an Ubuntu 18.04.01 virtual machine to poke at.  Then I dug out a Linux certification study guide and started reading.

It turns out cron jobs live in a bunch of different places, based on whether it is a system cron job or a user cron job.  System cron jobs run as root by default, and are meant to perform system maintenance functions.  User cron jobs are meant for all other tasks, in this case automating a sync for a Google group.  To create a cron job you create a crontab (CRON TABle) file that has a list of entries to run and what times they should run.  Basically speaking, it reads as time to run the thing and terminal command to do the thing.  There are five available fields to configure the time a job runs; minutes, hours, day of the month, month, and day of the week.  In my case I want the job to run at 8 p.m. every day, which looks like this:

* 20 * * 1-7 gam update group classroom_teachers@ domain.org sync member notsuspended ou_and_children "OU Name"

The crontab command has a limited amount of switches, which include -e (edit/create crontab file), -l (list jobs/display content), -r (remove crontab file), and -u(define the user).  Some systems offer a -v switch that allows you display last edit or -i that prompts before deleting the crontab file.  The first time I opened the crontab file I was asked to choose a text editor.  I chose nano, but some literature I found suggested vi editor was the default.

For the purposes of testing I did adjust the time so it ran while I was actually at work.  I did not install or configure any Mail Transfer Agent on the testing VM, and ended up just checking the syslog to see if it ran.  That command I used is: grep CRON /var/log/syslog if you need it.

I definitely need to give a shout out to this site (http://www.adminschoice.com/crontab-quick-reference ) which helped tremendously.

All in all I consider it time well spent, and it certainly helps that this automation applies directly to my daily routine.

Comments

  1. Wynn casino opens in Las Vegas - FilmfileEurope
    Wynn's first hotel gri-go.com casino in Las Vegas since opening its doors jancasino in 1996, Wynn Las Vegas 토토 사이트 is the first hotel on the Strip to offer such casinosites.one a large novcasino selection of

    ReplyDelete

Post a Comment

Popular posts from this blog

No, You Don't Need That Highlighter App (A discourse on Google for Education and FERPA)

Simulating Walled Gardens with G Suite Sharing and Directory Settings

G Suite Organizational Unit Structure in a K-12 Environment