With the RJM Programming domain we are regularly dealing with a Linux (CentOS) web server operating system and its associated command line we access via ssh command (usually from our macOS Terminal application command) …
ssh -p 22 [username]@[RJM Programming domain IP address]
In that Linux world, we like to think about “Interactive” usages (usually one offs) and “Scheduled” usages (usually via crontab (and quite often in combination with curl)) usually using commands and/or Korn Shell scripting.
There are occasions when we find an issue with the “Scheduled” side of operations, or the cards it was dealt (ie. human error writing the Blog Posting content), and to circumvent the waiting of a day to rerun the “Scheduled” work, we …
- fix the human error(s) writing the Blog Posting content
- we run an “Interactive” version of relevant “Scheduled” commands to set things right
With Linux and Korn shell it is very useful to know that the semicolon ( ie. ; ) delimiter can chain commands together, and even better than the type ahead buffering of VAX/VMS days, we can see it all assembled before our eyes ahead of committing to “letting it fly”, so to speak. At the command line prompt we first type …
crontab -l
- highlight (with mouse down) first command of use in Terminal application, right click, Copy
- use Terminal application’s Edit -> Paste to slot into the command line
- at command line type ;
- repeat three steps above for rest of relevant commands in order
- if you are happy to leave all this running and logout at the end, type in exit
- hit Return key to start off running these commands
The exit idea is not as radical as you might think, especially because the Terminal application rerunning the same ssh command will remember this whole chained together arrangement, on logging in, via the up arrow way you can look through the history of command line commands when working with Linux (or macOS, for that matter).
Of course, if stuff ups occur regularly take a Bex you can write this chain of commands into a Korn Shell script file with a first record of #!/bin/ksh (perhaps in this scenario, not needing the exit) (you could call myKornShell.ksh for example) and make executable via permission arrangement like (at its loosest being) chmod 777 myKornShell.ksh where all you need to do to perform the equivalent would be to go, at the similar command line environment …
./myKornShell.ksh
If this was interesting you may be interested in this too.