Archive for the ‘unix’ Category

script in /etc/cron.daily/ do not run

Sunday, June 20th, 2010

I created a shell script to be run daily, and as such I placed it into /etc/cron.daily, made it executable and even restarted cron daemon, but it was still not working. After investigating cron manual, the reason was simply because the name of the script contained a dot in it! (it ended with .sh)!!!

To make sure your script gets executed, do the following:

  1. move your script into /etc/cron.daily|weekly|monthly folder
  2. make your script executable (chmod a+x /etc/cron.xxx/<my_script_name>)
  3. rename your script so that its name contains only lower|upper case letters, digits, underscore and hyphens (=> NO DOT => no .sh or .xxx extension)
  4. ensure your script will be called by running: run-parts –test /etc/cron.xxx/
    (it outputs the name of all script that will be called, without actually calling them => make sure the name of your script is displayed)

That’s it!
If you want to immediately run your script the way cron does, run “run-parts –verbose /etc/cron.xxx”

sources

  • man cron

extract part of a video file

Thursday, June 17th, 2010
  1. To extract part of a video file
    => you can use avidemux (apt-get install avidemux), usage is pretty straight forward
  2. To convert a dvd into divx
    => you can use dvd:rip (apt-get install dvdrip), usage is pretty straightforward (first, load TOC, then rip selected track, last encode it)
  3. Convert a video into mp3 (ie. extract soundtrack)
    => use either avidemux (select ‘mp3′ as audio output on left menu, the on top menu fo to /audio/save after having loaded the video) or ffmpeg (see similar post on this blog)

sources

login as root user on ubuntu box

Monday, May 31st, 2010

Due to badly implemented shell script I had to give root user’s password to a shell script (pretty ugly I must admit!).

Problem is that with ubuntu, by default you cannot use root user account. To change this simply run: “sudo passwd root” and then set your password for root user.

If you want to go one step further and login into gnome as root (which I recommend NOT to do at all – I personally do not do it, never), then do the following:

  • run “sudo gedit /etc/X11/gdm/gdm.conf”
  • locate ‘AllowRoot=false’ and change it into “AllowRoot=true’
  • save your changes

That’s it.

sources

how to move thunderbird emails & profile from one computer to another [solved]

Sunday, May 2nd, 2010

Nothing easier!

  1. look for your profile folder (~/.thunderbird/xxxxxxx.default), copy it and paste in on your new computer at the equivalent location
  2. update ‘profiles.ini’ file to point to your profile folder (ie. update it to match ‘xxxxxxx.default’)
  3. start Thunderbird

That’s it.
Nothing easier.

sources

add new locale under ubuntu

Thursday, April 29th, 2010

When I tried to run “sudo dpkg-reconfigure locales” to add a new locale as I used to do it on debian, it simply regenerated my existing locales without letting me the choice to add/remove new ones!

After searching the web, it looks like under ubuntu you need to:

  1. open /var/lib/locales/supported.d/local
  2. add your locale (let’s say en_US.ISO-8859-15 ISO-8859-15)
  3. regenerate your locales: “sudo dpkg-reconfigure locales”

I’m pretty sure (at least I hope) there’s a better way to do it, but this way worked for me.

sources

cups-pdf no longer working on ubuntu 10.04

Thursday, April 15th, 2010

I updated my ubuntu box, and it automatically removed cups-pdf… I installed it again, and guess what, it no longer worked. When trying to print into pdf, I noticed the following message:

backend /usr/lib/cups/backend/cups-pdf does not exist

I already faced this message in a previous life (see cups-pdf not working on Ubuntu Intrepid).
note:
read above post to ensure you have correctly configured cups-pdf otherwise solution explained on this page might no be the cause of your trouble

To have cups-pdf work again I had to do the following:

  1. purge cups-pdf package (simply removing it is not enough):
    sudo apt-get purge cups-pdf
  2. reinstall it:
    sudo apt-get install cups-pdf

    note: you do have to purge cups-pdf package, simply removing or simply forcing –reinstall when installing new cups-pdf package is not enough

That’s it! It should work by now.

sources

convert jpeg file(s) into single pdf

Wednesday, April 14th, 2010

simply run

convert *.jpg my_new.pdf

sources

lexmark x4650 on linux [it works!]

Tuesday, April 6th, 2010

It looks like Lexmark finally released some drivers for its printers on linux!!!

This is great news!

Simply go to www.lexmark.com, click on the download section, then enter your printer name (x4650 in my case) and hit search.
Click on drivers & downloads, then click on ‘downloads’ tab and if you’re lucky you will be able to download the driver for your distribution.

Once you’ve downloaded the gz file, unzip it and execute the shell script as root from a terminal.

I did not believe it, below are the printscreens!

Don’t get too enthusiastic though, printing works through usb cable connection, so far I did not make it work through wifi. Anyway, it’s a start, my printer is no longer a total paper weight!

sources

install specific version of debian package with apt

Thursday, March 11th, 2010

Let’s say you have multiple version of a package that are available and you want to install a specific one.
We will use ‘mysql-server-5.0′ package for our example:

remy@r12925:~$ apt-cache policy mysql-server-5.0
mysql-server-5.0:
Installed: (none)
Candidate: 5.0.32-7etch12
Version table:
5.0.32-7etch12 0
500 http://security.debian.org etch/updates/main Packages
5.0.32-7etch8 0
500 ftp://mir1.ovh.net etch/main Packages

5.0.32-7etch5 0
100 /var/lib/dpkg/status

You want to install bolded version of mysql-server-5.0 package.
Nothing easier!!
Simply run apt with following syntax:

apt-get install <package-name>=<version>

In our case, I would run “sudo apt-get install mysql-server-5.0=5.0.32-7etch8″

sources

Find in which .deb package a file belongs to

Wednesday, March 10th, 2010

If you want to find in which package a file is located, ‘apt-file’ is your friend:

  1. sudo apt-get install apt-file (we should install it first!)
  2. sudo apt-file update (we update its db)
  3. apt-file find myfilename

note: you can use –regexp | -x option to search using a regular expression pattern (apt-file -x find mypattern)

That’s it!

sources