Archive for the 'Scripting' Category

apt aliases

Hey there to the few Anglophone readers that still visit this site! Today’s post is not as short as usual but rather to the point, plus it also comes with an important announcement. But first things first so, let me just share with you guys a couple of bash aliases that I find particularly useful for dealing with apt or, in other words, when it comes to add/remove software from the command line in a Debian-based distro:

# ~/.bashrc: executed by bash(1) for non-login shells.
# some apt aliases
alias add="sudo apt-get install --allow-unauthenticated -y"
alias fix="sudo apt-get install --fix-broken --assume-yes"
alias remove="sudo apt-get remove --assume-yes"
alias update="sudo apt-get update --assume-yes"
alias upgrade="sudo apt-get upgrade --assume-yes"
alias expunge="sudo apt-get autoclean --assume-yes"
alias flush="sudo apt-get autoremove --assume-yes"

Interesting? If you liked the idea and actually want to use them, it’s as simple as pasting those anywhere within your .bashrc file.

Okey so now it’s time to my oh-so-important announcement! Well, since I’ve been trying to kind of have a blog here for a year a half now, and given that the overall feedback has been, let’s say far less frequent than my original expectations really, but most importantly because I know some of you were really waiting for this, I’ve decided to start posting in Spanish :)

That’s pretty much it. Muchas gracias por leerme y los despido entonces hasta la próxima.

PD: No quería dejar de saludar a todos mis compatriotas, deseándoles un muy feliz Día de la Independencia!
Un abrazo,

UNIX Programming: Simple Notifications With mailx

Hey there! I know it’s been a month since my last post, I’m sorry about that but I’ve been pretty busy this days, having a lot to do at work and also being a full time student, so anyway, this time I’m sharing with you a nifty tip regarding notifications using mailx on UNIX, so without further ado, here’s the actual code:

#!/bin/ksh
#
# mailx settings:
#
to="someone@somewhere.com"
subject="[Notification] Something happened."
body="Lorem ipsum dolor sit amet et cétera."
#
# run and notify:
#
runSomething && (echo $body | mailx -s "$subject" "$to")

I hope you find it interesting, thanks much for reading and don’t hesitate to leave a comment!

Checking For Duplicated Processes In Korn Shell

A couple of days ago I was needing to solve an issue with our EAI framework. The implementation of such framework could be basically described as instances of Java programs running under Solaris, but there’s a particular instance that should be running just once. So I wrote this tiny shell script to avoid launching that program twice:

#!/bin/ksh
#
theProcess=someProcess
if [ $(pgrep -u $USER -f $theProcess | wc -l) -gt 0 ] then
echo "There is an instance of "$theProcess" already running."
else runTheProcess
fi

someProcess could be any regex that matches the process description,
runTheProcess is whatever command that executes the process.
Okay, that’s all, I hope you’ve found it informative and thanks for reading!

Getting Started with Grails

Grails is an open-source, rapid web application development framework that provides a super-productive full-stack programming model based on the Groovy scripting language and built on top of Spring, Hibernate, and other standard Java frameworks.

Getting Started with Grails

Jason Rudolph is an Application Architect at Railinc, where he develops software that helps keep trains moving efficiently throughout North America.

The book can be downloaded for free (registration required), but also you could always purchase the printed copy.

Next Page »