Passing arguments to a script started through Ubuntu Upstart

Writing by on Thursday, 9 of October , 2014 at 5:54 pm

If you’re trying to use the –exec option and need to pass in arguments, then you would need to use — to let –exec know that these are arguments to the script that needs to be executed.

# No arguments passed to test.py
exec start-stop-daemon –start –exec python test.py

# Arguments (-i $PARAM) passed to test.py
exec start-stop-daemon –start –exec python test.py — -i $PARAM

Leave a comment

Category: Linux,Python

Virtual Box Running Ubuntu

Writing by on Friday, 19 of September , 2014 at 3:54 pm

While using VirtualBox running a Ubuntu Image, I found some helpful topics to:

Leave a comment

Category: Linux

Export DISPLAY on RHEL Red Hat Enterprise Linux

Writing by on Saturday, 8 of June , 2013 at 3:50 am

On the source machine

[user@sourcemachine ~] echo $DISPLAY
:1011.0
[user@sourcemachine ~] xhost +

On the remote machine

[user@sourcemachine ~] ssh user@remotemachine
[user@remotemachine ~] export DISPLAY=sourcemachine:1011.0
[user@remotemachine ~] /usr/bin/firefox &

OR

[user@sourcemachine ~] ssh -X user@remotemachine
[user@remotemachine ~] /usr/bin/firefox &

With the ssh -X option, you don’t need to worry about DISPLAY, but some applications might not work.

Leave a comment

Category: Linux

NX Connection Issue DSA key is corrupted or has been protected with a passphrase

Writing by on Tuesday, 30 of April , 2013 at 10:50 pm

If NX Client is not able to connect to Linux VM and comes back with the following error

DSA key is corrupted or has been protected with a passphrase

You will need to follow steps mentioned in the NX Admin Guide – Section 4.4. Replacing the Default SSH Key-Pair with Keys Generated for Your Server.

Once you follow the steps of generating new keys, you will need use (paste) the new shared key in the NX Client.

#Follow the keygen steps
$ /usr/NX/scripts/setup/nxserver –keygen
$ … … …
# Copy the Key from
$ cat /usr/NX/share/keys/default.id_dsa.key
# Paste this Key in the NX Client (Configure… General Tab -> Key…)

The problem should be resolved.

Leave a comment

Category: Linux

Correlating Linux top output with java stack trace from a thread dump

Writing by on Thursday, 21 of February , 2013 at 12:23 am

Using the top -H command to show you the thread ids, and from the thread dump, you can correlate the thread that’s taking CPU time.

For example the stack trace will show you the ID in hex format and the top will show you the thread PID in decimal format.

Notice that nid=0x6c21 (top -H) is the same as 27681 (from the thread dump).

Here’s a thread dump snippet

“http-bio-/127.0.0.1-9090-exec-7” daemon prio=10 tid=0x000000004c433800 nid=0x6c21 runnable [0x00000000644b9000]
INFO | jvm 1 | 2013/02/20 11:51:57 | java.lang.Thread.State: RUNNABLE
INFO | jvm 1 | 2013/02/20 11:51:57 | at java.util.HashMap.put(HashMap.java:374)

Here’s the output of top -H

[root@myserver bin]# top -H

top – 15:56:17 up 5 days, 5:16, 8 users, load average: 2.16, 2.25, 3.28
Tasks: 1038 total, 3 running, 1035 sleeping, 0 stopped, 0 zombie
Cpu(s): 12.8%us, 0.1%sy, 0.0%ni, 87.1%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 37043972k total, 35569196k used, 1474776k free, 45720k buffers
Swap: 12586916k total, 228k used, 12586688k free, 18998952k cached
3.00 00:04:50
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
27409 shivdev 25 0 11.6g 10g 16m R 99.9 30.7 1305:02 java
27681 shivdev 25 0 11.6g 10g 16m R 99.9 30.7 1304:37 java

Leave a comment

Category: Java,Linux

Clear Recent Files History in Ubuntu 12.04

Writing by on Monday, 17 of December , 2012 at 6:08 am

To Delete Recent Files (past hour, past day, past week, all)

System Settings -> Privacy -> Delete History

You can leave
Record Activity On/Off

Leave a comment

Category: Linux

Shivdev Kalambi's Blog

Shivdev Kalambi is a Software Development Manager, previously a Principal Software Engineer at ArcSight/HP. With over 16 years' experience in software development, he's worked on several technologies and played different roles and contributed to all phases of projects. Non-tech activies include Ping-pong, Rock Climbing and Yoga at PG, Golf, Skiing, Swimming & a beer enthusiast.