Script to Watch for Ubuntu 9.10 Launch – can be used in other scenarios.

2010-02-10 1 min read Linux

I know ubuntu is out already but this is something that you can use to monitor a webpage.

This script will run check a for the Ubuntu 9.10 launch once every 5 mins and let you know when it’s available:

while [ 1 ]; do if [ -z \"`curl -I \"http://cdimage.ubuntu.com/releases/9.10/release/\"|grep \"404\"`\" ]; then kdialog --msgbox \"9.10 Released\"; exit; fi; sleep 300;  done

<a href="http://feedads.g.doubleclick.net/~a/99XcDO7_UNXZESNlOirXkV4_tfA/0/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/99XcDO7_UNXZESNlOirXkV4_tfA/0/di" alt="" align="bottom" />
<a href="http://feedads.g.doubleclick.net/~a/99XcDO7_UNXZESNlOirXkV4_tfA/1/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/99XcDO7_UNXZESNlOirXkV4_tfA/1/di" alt="" align="bottom" />

Continue reading

bash script with sql to get the number of records from multiple tables.

2010-02-10 1 min read Bash Database Learning Linux Solaris

Here is the bash script:

#!/bin/sh
names[1]=errorlog
names[2]=amit1log
names[3]=amit2log
names[4]=amit3log
names[5]=amit4log
j=1
echo $1
for i in $( sqlplus amit/passwd@tns @get_count.sql |sed  -n &#8217;/COUNT/,/Disconnected/p&#8217;|sed &#8217;/COUNT/ d&#8217;|sed &#8217;/—/ d&#8217;|sed &#8217;/Disconnected/ d&#8217;|tr &#8217;n&#8217; &#8217; &#8217;  )
do
temp=${names[$j]}
let count=30-${#temp}
for ((I=1; I <= $count ; I++))
do
printf &#8221; &#8221;
done
echo  &#8221;${names[$j]}    : $i&#8221;
# echo $j
let j=j+1
done
echo
echo

and the required sql script:

select count() from errorlog;
select count(
) from amit1log;
select count() from amit2log;
select count(
) from amit3log;
select count(*) from amit4log;
quit;

Continue reading

x-marks saving lives.

2010-02-04 1 min read Firefox

Couple of days back my TeraByte HDD crashed and I lost almost everything, including my homedir. I will tell you my experiences and how my measures helped me lose not much data. So I will begin with one of the most important aspects. My BROWSER.

I have all my passwords stored in the browser and I rely on them so it is not stored anywhere else. Also, I have lot of bookmarks which help me do lot of stuff. Meaning, all these are very important for me. So, I had a backup plan for my passwords and bookmarks.

Continue reading

PackageKit error File \”/usr/share/PackageKit/helpers/yum/yumBackend.py\”, line 1215, in _get_depends_not_installed – Resolved

2010-02-04 1 min read Fedora

In packagekit, if you getting the error below:

Traceback (most recent call last):
File &#8221;/usr/share/PackageKit/helpers/yum/yumBackend.py&#8221;, line 1215, in _get_depends_not_installed
rc, msgs =  self.yumbase.buildTransaction()
File &#8221;/usr/lib/python2.6/site-packages/yum/__init__.py&#8221;, line 719, in buildTransaction
self.plugins.run(&#8217;postresolve&#8217;, rescode=rescode, restring=restring)
File &#8221;/usr/lib/python2.6/site-packages/yum/plugins.py&#8221;, line 179, in run
func(conduitcls(self, self.base, conf, **kwargs))
File &#8221;/usr/lib/yum-plugins/remove-with-leaves.py&#8221;, line 71, in postresolve_hook
if opts.remove_leaves or remove_always:
AttributeError: &#8217;NoneType&#8217; object has no attribute &#8217;remove_leaves&#8217;

then you can resolve it. The solution to the problem is there in the traceback, luckily this time.

Continue reading

How To Build A Self-hosted WordPress Blog For Free

2010-02-04 1 min read Linux

A blog is a layman-friendly variation of a website, and having a blog is one of the many ways to state your presence in the virtual world. While there are many hassle-free blog services out there that will take care of everything except automatically blog for you – like <a href="http://www.makeuseof.com/tags/blogger">Blogger and <a href="http://www.makeuseof.com/tags/wordpress">WordPress, nothing can beat a self-hosted blog in the terms of customization and self pride.

The problem is, the process of building your own self-hosted blog is (almost always) not free and is considered complicated. So most newbies will choose the easier path and never give themselves a chance to experiment.

Continue reading

Splitting strings with IFS

2010-02-04 2 min read Bash Linux

Today I want to discuss splitting strings into tokens or “words”. I previously discussed how to do this with the <a href="http://bashcurescancer.com/reading-a-file-line-by-line.html">IFS variable and promised a more in depth discussion. Today, I will make the case on WHY to use IFS to split strings as opposed to using a subshell combined with <a class="zem_slink freebase/en/awk" title="AWK" rel="homepage" href="http://cm.bell-labs.com/cm/cs/awkbook/index.html">awk or cut.

I wrote this script which reads the /etc/password file line-by-line and prints the <a class="zem_slink freebase/en/user" title="User (computing)" rel="wikipedia" href="http://en.wikipedia.org/wiki/User_%28computing%29">username of any user which has a UID greater than 10 and has the shell of /sbin/nologin. Each test function performs this task 10 times to increase the length of the test:

Continue reading

Kill processes that have been running for more than a week

2010-02-04 1 min read Linux

<a href="http://blog.amit-agarwal.co.in/category/linux/">Bookmark this category

<span style="font-size: x-large;"><a href="http://feedproxy.google.com/~r/Command-line-fu/~3/kr_otvdAVxA/kill-processes-that-have-been-running-for-more-than-a-week">Kill processes that have been running for more than a week
$ find /proc -user myuser -maxdepth 1 -type d -mtime +7 -exec basename {} ; | xargs kill -9

  • <a href="http://www.commandlinefu.com/commands/view/3702/kill-processes-that-have-been-running-for-more-than-a-week">View this command to comment, vote or add to favourites
  • <a href="http://feeds2.feedburner.com/commands/by/sharfah">View all commands by <a href="http://feeds2.feedburner.com/commands/by/sharfah">sharfah

<a href="http://www.commandlinefu.com"><img src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/header-logo.jpg" alt="commandlinefu.com" align="bottom" />

by David Winterbottom (<a href="http://codeinthehole.com">codeinthehole.com)

<a href="http://feedads.g.doubleclick.net/~a/NeXCFRlIt7EM3A_bb4x2jLaegwk/0/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/amit-agarwal.co.in/~a/NeXCFRlIt7EM3A_bb4x2jLaegwk/0/di" border="0" alt="" align="bottom" />
<a href="http://feedads.g.doubleclick.net/~a/NeXCFRlIt7EM3A_bb4x2jLaegwk/1/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/amit-agarwal.co.in/~a/NeXCFRlIt7EM3A_bb4x2jLaegwk/1/di" border="0" alt="" align="bottom" />

Continue reading
Older posts Newer posts