When I run a long running command and can't be bothered to check up on it.
I start it with nohup so I can log out. It returns a which pid it was started with
bash-2.05$ nohup [command] > log.log &
Sending output to nohup.out
[1] 1247
Then I start a monitor script that mails me when the process is finished
bash-2.05$ nohup ./mail_when_finished.sh 1247 &
Script (works on solaris):
--------------------------------
#!/usr/bin/sh
trap '' 1
pid=$1
bail_out () {
mail name@domain.com <Subject: My_Job has finished
Importance: high
X-Priority: 1
My_Job has finished running.
.
!done
exit 0
}
check_it () {
while :
do
ps -p $pid > /dev/null 2>&1
case $? in
0) sleep 120 ;;
*) bail_out; exit 1 ;;
esac
done
}
check_it
---------------------
I took and modified the script from http://www.unix.com/shell-programming-scripting/3205-lightwight-process-monitor.html
Thursday, 22 May 2008
Monday, 14 January 2008
Installing Ubuntu on MacBookPro (SantaRosa)
I bought a MacBook in a weak moment but realized that OS X is overhyped.
Therefore I decided to install ubuntu 7.10. This are the steps I took (after a lot of googling).
There are a lot of information but none worked 100% for me.
The whole problem was that when I installed it, the screen was just empty or it stopped at "running local boot scripts".
Now I hope that I can follow the documentation on the web. I'll get back on that.
Therefore I decided to install ubuntu 7.10. This are the steps I took (after a lot of googling).
There are a lot of information but none worked 100% for me.
The whole problem was that when I installed it, the screen was just empty or it stopped at "running local boot scripts".
- Made a backup... with time machine.
- used boot camp to make a new partition.
- installed refit
- Downloaded ubuntu (after a lot of trying I used the "alt"-version 64 bit)
- When the install selection window is shown. Press F6. You will get boot command that you can edit. Remove "splash" and "quiet"
- Start in safe graphics mode
- After some time it will stop on "running local boot scripts"
- do a control-c and on the prompt write "startx"
- wait for a few minutes and you will get the "normal" install window.
- Install as normal, remember to choose the correct keyboard
- Important. Do not allocate 100% of your partition. It seems like Ubuntu needs to save some on the harddisk.
Now I hope that I can follow the documentation on the web. I'll get back on that.
Monday, 26 November 2007
Nohup and sqlplus for long oracle batch jobs
To run a batch job in oracle. You want to use nohup, redirect the nohup.log etc.
nohup sqlplus [user]/[pwd] @[script] / -print > [logfile] &
note that the "-print >" is not to be changed
The spooling doesn't work due to the fact that the spool buffer seems to be flushed at the end of the script
nohup sqlplus [user]/[pwd] @[script] / -print > [logfile] &
note that the "-print >" is not to be changed
The spooling doesn't work due to the fact that the spool buffer seems to be flushed at the end of the script
Wednesday, 29 August 2007
Using headers in GWT FlexTable
I'm a moron. I've been dicking around with headers in GWT FlexTable for a while. I simply added rows and used a different styleset for the headers. Then I had to subtract and add for each table operation....
The solution is (of course) to insert table headers with the DOM-class in GWT.
The solution is (of course) to insert table headers with the DOM-class in GWT.
Now the number of rows, clear etc works fine. FlexTable uses "correct". The camel back IE "feature" took me a while though.
/**
* Initializes the table with header rows. The headers are defined by the headerModel
* This adds the header rows directly to the table, using the DOM-class. The current FlexTable implemenetation
* doesn't have headers. This uses the normal html ... syntax
*/
private void initTable() {
Element thead = DOM.createTHead();
DOM.insertChild(table.getElement(), thead, 0);
for (int row = 0; row <>
Element tr = DOM.createTR();
DOM.appendChild(thead, tr);
for (int col = 0; col <>
Element th = DOM.createTH();
DOM.appendChild(tr, th);
// NB!!!! camelback on attributes for IE or despair
DOM.setElementAttribute(th, "colSpan", String.valueOf(headerModel.getHeaderSpan(row, col)));
DOM.setElementAttribute(th, "align", "left");
DOM.setElementAttribute(th, "border", "1");
//set header text
DOM.setInnerText(th, headerModel.getHeaderText(row, col));
}
}
}
Saturday, 11 August 2007
Printing protected PDF files
Once every year, I need to print a protected PDF-file. Of course I forget what I did in between. The main problem is that you can't print a protected file from the Adobe Reader even if you have the password. They want you to buy the full Adobe product
- Download pdfbox from sourceforge. The latest version does not work but version 0.7.0 works fine.
- Unzip it and go to the bin directory. Run: Decrypt.exe
. And the file is printable!!
Friday, 27 July 2007
Debug on Ant/Maven
When you run (for example) jetty from ant (or maven) and want to debug. Then you'll notice that jetty is not in its own process but in the actual ant/maven process. You can set all the jvmargs you want it will still not work. I'm here talking about the mortbay´s maven-jetty-plugin. This also contains the ant task.
The workaround is:
Ant:
execute ant with the setting "--execdebug" (ant runJetty --execdebug) . This will print the command to the console. Copy/paste/edit to a script (add the debug parameters -XDebug ...). Start this particular command from this script when you want to debug.
Maven:
Whenever you want to debug. set "export MAVEN_OPTS=", to enable debug. Do this on the command line or a script that starts the shell.
Obviously we are are now debugging entire maven/ant. If anyone has a better idea, let me know.
The workaround is:
Ant:
execute ant with the setting "--execdebug" (ant runJetty --execdebug) . This will print the command to the console. Copy/paste/edit to a script (add the debug parameters -XDebug ...). Start this particular command from this script when you want to debug.
Maven:
Whenever you want to debug. set "export MAVEN_OPTS=
Obviously we are are now debugging entire maven/ant. If anyone has a better idea, let me know.
Tuesday, 24 July 2007
First post
This blog is more or less for personal use. I will post things that I should remember and I work with. I'll try to write it as informative as possible but I suppose there will be nothing real ly interesting . However if anyone find any useable, feel free to read. Also if you have some improvements, let me know by commenting!!
Huskeliste means "list with things to remember" in Norwegian.
Huskeliste means "list with things to remember" in Norwegian.
Subscribe to:
Posts (Atom)