Stand With Ukraine

Wednesday, July 7, 2010

Set up alarm using crontab

I used crontab in order to get waked up in the morning (here at 7:50) by some song from youtube I like.
In home directory I created 2 files: alarm.sh and mycrontab. And then just issued the command:
crontab mycrontab

Contents of mycrontab:

50 7 * * * cd $HOME && ./alarm.sh

Contents of alarm.sh:

#!/bin/bash
export DISPLAY=:0.0
/usr/bin/firefox "http://www.youtube.com/watch?v=ebBBdJSHzJk&feature=PlayList&p=C262E364FC4756AF&playnext_from=PL&index=18&playnext=2"

Tuesday, June 29, 2010

Mac Ports automation bash script

Mac ports is a very useful system for installing linux applications ported to MacOS (http://www.macports.org), it is easy to use and I am happy with it till now. But it does not delete the old versions of software after update, or I just did not find a proper command for this. So I wrote this bash script to automate the task and successfully used it.
Here is its output during the execution:
radar2:tmp huziy$ ./port_cleaner.sh 
33
Password:
--->  Uninstalling hdf5-18 @1.8.4-patch1_1
--->  Uninstalling hdfeos5 @1.12_0
--->  Uninstalling ImageMagick @6.6.2-0_0+q16
--->  Uninstalling iso-codes @3.16_0
--->  Uninstalling libtool @2.2.6b_1+darwin
--->  Uninstalling mc @4.7.0.2_0+slang2
--->  Uninstalling mpfr @2.4.2-p1_0
--->  Uninstalling mpfr @3.0.0_0
--->  Uninstalling openmotif @2.3.2_2
--->  Uninstalling openssl @0.9.8n_0+darwin
--->  Uninstalling python26 @2.6.5_1
--->  Uninstalling xorg-libX11 @1.3.3_0
--->  Uninstalling xorg-libXcomposite @0.4.1_0
--->  Uninstalling xorg-libXdamage @1.1.2_0
--->  Uninstalling xorg-libXext @1.1.1_0
--->  Uninstalling xorg-libXfixes @4.0.4_0
--->  Uninstalling xorg-util-macros @1.8.0_0



And finally the script itself:



I used this tutorial http://tldp.org/LDP/abs/html/arrays.html to write the script.