Cron jobs

Cron jobs are perfect for executing a specific task or script at a scheduled time or different time periods.

Cron jobs can be run hourly, daily, weekly and monthly.

Cron configuration file is located:

/etc/crontab

This file should look like this:

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed

Execute a job every X minutes

*/5 * * * * /path/to/script/script.sh

Use */10 for every 10 minutes, */15 for every 15 minutes… and so forth..

Execute a job every X hours

0 */5 * * * /path/to/script/script.sh

Use */2 for every 2 hours, */3 for every 3 minutes… and so forth..

Execute a job every Xth day of the week

Lets assume you want to execute a cron job every Wednesday at midnight:

0 0 * * 3 /path/to/script/script.sh

or

0 0 * * Wed /path/to/script/script.sh

You can use the corresponding number or the three letters for each weekday:

0=Sun
1=Mon
2=Tue
3=Wed
4=Thu
5=Fri
6=Sat

Please note that numbers starts with 0 for Monday, and not 1.

Execute a job every X months

You need to specify the what specific month or months you want to job to be executed. Like January and September:

0 0 1 1,9 * /path/to/script/script.sh

or

0 0 1 Jan,Sep * /path/to/script/script.sh

If you only want January and September, you should use a comma. If you want the job to be executed starting January and ending September, you need to use this format: 1-9.

Advertisements

Video Thumbnail in Dolphin – Fedora 23/24

After a long, long, long time, finally I can view my videos thumbnails in Dolphin.

I reported a Bug in RPMFusion Bugzilla back in Januay 2016 and earlier this morning I got the surpise that it was Resolved!

I want to thank Leigh Scott for getting this done. I’m really happy about it, since I have lots and lots of videos and being able to look at a small thumbnail is really helpful.

So, to get the package installed, all you need to do is:

$sudo dnf install ffmpegthumbs

After that, just need to enable it in Dolphin by going to Preferences > Configure Dolphin > General > Previews > Video files (ffmpegthumbs) and that’s it!

Thanks again for making this happen.

Check your internet speed from command line with speedtest_cli

I found this the other day and couldn’t resist.

You can test your internet speed from command line using the python script “speedtest_cli”.

Here’s how to get it:

1. You can install it with pip:

pip install speedtest-cli

or use pip from github:

pip install git+https://github.com/sivel/speedtest-cli.git

2. Clone the whole code from github and install it with python:

git clone https://github.com/sivel/speedtest-cli.git
python speedtest-cli/setup.py install

3. Or just download the script and execute it.

wget -O speedtest-cli https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
chmod +x speedtest-cli

How to use it

From the command line:

$./speedtest_cli.py

Typical outout will be:

$ ./speedtest-cli 
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from XXX (XXX.XXX.XXX.XXX)...
Selecting best server based on latency...
Hosted by XXX (XXX) [2.12 km]: 92.277 ms
Testing download speed........................................
Download: 2.73 Mbits/s
Testing upload speed..................................................
Upload: 0.88 Mbits/s

You can even share your results by getting an image of it:

$ ./speedtest-cli --share

Which will generate a png file you can share.

Make sure to check all the option by using:

$ ./speedtest-cli --help

Install Firefox 14 in Debian

We need to enable the Ubuntuzilla Project repository for the latest Mozilla Firefox/Thunderbird/SeaMonkey build.

Add to our /etc/apt/sources.list:

deb http://downloads.sourceforge.net/project/ubuntuzilla/mozilla/apt all main

Then we need to add the GPG key:

apt-key adv --recv-keys --keyserver keyserver.ubuntu.com C1289A29

Then:

#apt-get update
#apt-get remove iceweasel ; apt-get install firefox-mozilla-build

This will remove Iceweasel and install the latest Firefox build.

Hope this works for you 🙂

VNC Server – Fedora 16

This are the basic steps I use to create a VNC Server configuration in my Fedora 16.

1. Install VNC Server (as root):

# yum -y install tigervnc-server

2. Create a password for our VNC Server (this has to be done as a regular user, not as root):

# vncpasswd

3. Let’s create a start configuration that we can later edit:

# vncserver :1

4. Now that we have just created a basic configuration, let stop our running server:

# vncserver -kill :1

5. Let’s edit our VNC configuration file:

# vi ~/.vnc/xstartup

Let’s comment the actual last line:

#twm &

Now, we need to add a line at the end of the file:

exec gnome-session & # This is for using Gnome

6. Now we can start up again our VNC Server:

# vncserver :1 -geometry 800x600 -depth 24

You can change the resolution at your convenience.

7. Now it’s safe to test and use our running VNC Server:

If you need any more info please refer to this article:

Install VNC Server

Install Skype in Fedora 14 (64 bits)

Since Skype doesn’t provide a 64 bits version, we can use the 32 bits version if we are using a Fedora of 64 bits.

1. Install the i686 pre-requisite packages.

yum -y install pulseaudio-libs.i686 pulseaudio-libs-devel.i686 alsa-plugins-pulseaudio.i686 libv4l.i686   libXv.i686 libXv-devel.i686 libXScrnSaver.i686  libXScrnSaver-devel.i686 dbus-qt.i686 dbus-qt-devel.i686 qt.i686 qt-devel.i686

2. Download Skype i586 (fedora 10+)

wget http://download.skype.com/linux/skype-2.1.0.81-fc10.i586.rpm

3. Install Skype

yum -y localinstall skype-2.1.0.81-fc10.i586.rpm --nogpgcheck

We can now run our new Skype Installation.

Enable Java plugin in Firefox (Fedora)

To enable the Java plugin in Firefox under our Fedora 64 or 32 bits, this is what we need to do, a simple symbolic link:

64 bits:
ln -s /usr/java/latest/jre/lib/amd64/libnpjp2.so /usr/lib64/mozilla/plugins
32 bits:
ln -s /usr/java/latest/jre/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins/

This is assuming that we have properly installed JDK first. If you see, we are pointing to the latest java instalation, this will be usefull when we update our java version.

We can check if everything worked out fine over here:

Mozilla Plugin Check

If everything is working correctly, we should see an output like this:

Mozilla Plugins Checker

Hope this works for you.

Install Chromium in Fedora 13 (Updated 09/08/2010)

Since Fedora comes with Firefox as the default internet browser and there is no way to install Chromium by default, I leave you this post on How to Install Chromium in Fedora in a few easy steps.

First of all… What is Chromium?….

this is an open source browser developed by Google (and it’s the base for his Google Chrome).

By default, Chromium can’t be installed by default in fedora due to some issues with packaging…
(check this article: Why Chromium Isn’t in Fedora).

Now, to the steps:

1. Open a terminal window and type:

su

2. Create a “chromium.repo” file in “/etc/yum.repos.d” using the following command at Terminal

gedit /etc/yum.repos.d/chromium.repo

3. In the opened file paste the following code

[chromium]
name=Chromium Test Packages
name=Chromium for Fedora
baseurl=http://spot.fedorapeople.org/chromium/F$releasever/
baseurl=http://repos.fedorapeople.org/repos/spot/chromium/fedora-$releasever/$basearch/
enabled=1
gpgcheck=0

4.Save and close the file and at the terminal type the following command

yum install chromium

This should install Chromium on your Fedora 13. You can find it under Applications > Internet > Chromim Web Browser.

Following a screeshot of Chromium running on my Fedora 13.

Installing JDK in Fedora 17 (Updated for the JDK 6.0 update 35 64 bits)

First thing we need to do is get the JDK installer
JDK Home @ Oracle.com

Once we have the installer in our local repository (as root):

chmod a+x  jdk-6u35-linux-x64-rpm.bin
./jdk-6u35-linux-x64-rpm.bin

Let’s update our alternatives:

alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_35/jre/bin/java 20000
alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.6.0_35/jre/bin/javaws 20000
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jdk1.6.0_35/jre/lib/amd64/libnpjp2.so 20000
alternatives --install /usr/bin/javac javac /usr/java/jdk1.6.0_35/bin/javac 20000
alternatives --install /usr/bin/jar jar /usr/java/jdk1.6.0_35/bin/jar 20000

To confirm that our installation is successfull:

java -version

Should give us an ouptput like this:

#java -version
java version "1.6.0_35"
Java(TM) SE Runtime Environment (build 1.6.0_35-b10)
Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01, mixed mode)

That’s it. Enjoy.