shell

Re-Writing a GlobalProtect OpenConnect VPN Connect script in Babashka

** Edit 2023.001.17: fixed syntax errors CLI command in /usr/bin and username > user This is an update of a previous Babashka1 project2, changed because my organization has switched to a Palo Alto GlobalProtect VPN instead of our former Cisco one. Originally this posed a major problem for OpenConnect, which had troubles with GlobalProtect, but with wersion 9+ of OpenConnect it works smoothly (as long as your provider doesn’t require SAML authentication, which is apparently still buggy in OpenConnect 9).

One-line CLI mail to multiple recipients with inline content

Intro I found a one-liner that allowed me to test the outgoing mail setup on a remote server. The following one-liner worked, and introduced me to some new-to-me functionality with Bash and Mail. mail -s "Testing Not registration confirmation" -r from@address.com to1@example.com,to2@example.com <<< 'testing 4' Analysis mail The command assumes that you already have a working Mail1 aka PostFix setup on the server you are running on, which means a sendmail setup.

Find the process id of a running process

The command Sometimes I started a command with a java -jar mything.jar & long ago, and now it needs to be updated, and I haven’t got around to properly instrumenting it yet. Here is the command that helps me find and shutdown the old process so I can restart it. ps -ef | grep mything Resources https://community.talend.com/s/article/How-to-find-and-kill-a-process-running-on-a-port-LVJkZ?language=en_US#auraLoadingBox

Re-Writing an OpenConnect VPN Connect script in Babashka

This is the second of a 2-part series of articles.1 It was updated 2021.005.24 to add the :servercert option to the openconnect command. The sundries of just handling arguments and options2 was alone so annoying in Bash that I finally used it as an excuse to play with Babashka3, which I’ve been watching eagerly for quite a while. The script itself is small while providing niceties that would have taken much longer, and also more lines of code, to implement in Bash.

Writing an OpenConnect VPN Connect script in Bash

Bypassing proprietary GUI for VPN connection was a very productive idea, and using OpenConnect to replace the Cisco AnyConnect client which was continually breaking for me proved nice, and provided a nice1 command-line interface to make it scriptable. This is part of a series2 of articles because making something even as trivial as an API wrapper in Bash, gave me a mortifying glimpse of the antiquity of Bash. So after this article, check out the re-work in Babashka, a fast and much better designed interpreter that works as a shell script.

Clojure app setup for Auto-deploy with raw systemd

REPLACED [2022-11-11 Fri] The below is hopefully informative, but it actually only causes a thing to deploy once and then to re-deploy on system restart. For instructions that ACTUALLY auto-deploy, see https://tech.toryanderson.com/2022/11/11/systemd-devops-run-and-restart-services/ Updated [2022-09-19 Mon] Fixed error in deploy script that occurred if trying to restart but nothing was in the docket Updated [2022-07-13 Wed] Enhanced the server-side deploy script to operate more transparently if files are missing.

Quickly Creating DB namespaces with shell, emacs, and init.sql

My project design includes creating a file/namespace for each database table, with a suite of CRUD operations applying to each table. The end result is that I have functions like db.my-table/CREATE, READ, UPDATE, and DELETE available for each table. The strategy is as follows: Establish the template clj file that has all your CRUD operations Obtain all table names (e.g. from init.sql) Use a script to create a matching clj file based on template (1) customized to refer to the tables from (2) 1.

Building custom x11 cursors for Linux

I wanted to use the sort of Starcraft game cursors I enjoyed on my windows machine as a teenager, and this was my first thought of custom cursors in Linux. Note that I use EXWM as a low-level window manager, so these instructions should work for most any Linux system. Spoiler: I got it working, but it took a good deal of time that I hope you might be saved. Here is my story.

Useful shell scripts

Placing little scripts in your ~/bin directory makes it abundantly clear why some people love shell scripting, and some jobs require shelll scripting as a skill. It seriously improves the speed and ease of life. Here are a few that I enjoy: Crashplan Because I sometimes need to micromanage my backup software and the software doesn’t function if I try linking it to another folder this simplifies things. #!/bin/bash # file: /~/bin/crash CRASHPLAN_DIR=/usr/local/crashplan/bin cd $CRASHPLAN_DIR; sudo .

Finding a File's Full Path in Linux

Particularly when coding and you need to make links to files or libraries, or if you use sym links to streamline your file system, it can be very useful to find the Fully Qualified Path (sometimes referred to as FQP) of a file. This command does the trick: readlink -f ./MyFile.txt