2013-11-20

Bash script to manage sshfs


If you wanna use sshfs, this software should be installed:


$apt-get install openssh-client openssh-server sshfs 

If server not always online and you want to mount automatically sshfs when server online, I use this bash.

Bud before running bash, you have to be able connect to server without a password.

You have to create pabulic key on client

$ssh-keygen -t rsa

And then copy key from client ~/.id_rsa.pub (single long line in the text file)
to server ~/.ssh/authorized_keys 

I added this script to "Startup Applications".


Download sshfs.bash

#!/bin/bash

echo $0

# =======================================================
# CONFIGURATION
REMOTE_IP="192.168.1.2"
REMOTE_USER="user"
REMOTE_PATH="/home/"
MOUNT_POINT="/media/sshfs/"

# =======================================================
# VARIABLES
BOOL_ONLINE=0
BOOL_MOUNTED=0
BOOL_PID_RUN=0
# =======================================================
# FUNCTIONS


FUNC_remote_net_stat()
{
NET_STATUS=`ping ${REMOTE_IP} -c 1`

    if grep -q "64 bytes from ${REMOTE_IP}: icmp_req=1 ttl=64 time=" <<< "$NET_STATUS" ; then
        echo "ONLINE"
        BOOL_ONLINE=1
        else
        echo "OFFLINE"
        BOOL_ONLINE=0
    fi
}


FUNC_pid_status()
{
PID_STAT=`ps axu`

    if grep -q "sshfs ${REMOTE_USER}@${REMOTE_IP}:${REMOTE_PATH}" <<< "$PID_STAT" ; then
        BOOL_PID_RUN=1
        echo "PID RUNNING"
        else
        BOOL_PID_RUN=0
        echo "PID DEAD"
    fi
}

# =======================================================
# SCIPT BODY


    while true
    do
        FUNC_remote_net_stat
        FUNC_pid_status
       
        if [ $BOOL_ONLINE -eq "1" ]; then
       
       
            if [ $BOOL_PID_RUN -eq "1" ]; then
            BOOL_MOUNTED=1
            fi
       
            if [ $BOOL_MOUNTED -eq "0" ]; then
            echo "MOUNTIN SSHFS ..."
   
            SSH_MOUNT=`sshfs ${REMOTE_USER}@${REMOTE_IP}:${REMOTE_PATH} ${MOUNT_POINT}`

                if [ ! -z "$SSH_MOUNT" ]; then
                echo "ERROR ${SSH_MOUNT}"
                else
                BOOL_MOUNTED=1
                fi
            echo "DONE"    
            fi   
        fi
       
       
        if [ $BOOL_ONLINE -eq "0" ]; then
       
            if [ $BOOL_MOUNTED -eq "1" ]; then
            echo "KILLING SSHFS ..."
            kill `pidof ssh`
            BOOL_MOUNTED=0
            echo "DONE"
            fi
        fi
       
        if [ $BOOL_MOUNTED -eq "1" ]; then
       
            if [ $BOOL_PID_RUN -eq "0" ]; then
            BOOL_MOUNTED=0
            fi
        fi       
       
    sleep 5
   
   
    done


echo "EXIT"

# THE END
# =======================================================

2013-11-12

Linus Torvalds Interviews






Desktop Environment's for Linux MINT



KDE

http://kde.org/
http://www.youtube.com/watch?v=3zpdjySiS88
http://www.youtube.com/watch?v=dohhz91OTPY

  It looks really cool, bud too much sparkles for every day work...

Cinnamon
http://segfault.linuxmint.com
  Today looks best! I did try Mint cinnamon 16.
The Ideas I like a lot!
* Great art work.
* Work space switcher by the mouse in the top left corner.
* Managing windows by dragging them to the sides or top.
Very useful features.
Bud sorry it's to buggy...
* Unable connect to hidden Wifi, Network settings window crash every time.
* I try organize panel content - unsuccessful.
* Some thing wrong with the package manager (I believe it's fixable).
Experience was similar to Ubuntu bugs in the passed, it was Ubuntu version 12.10 (don't know how it is now).
So I guess I have to wait for more stable Cinnamon, and stick to Mate for now. 


MATE
http://mate-desktop.org/
  Good! I enjoy it! (Mint 14)

I try live Mint Mate 16 - still great!
Unfortunately installation has some issues.
* Proprietary Drivers Installer works, bud nviadia xconfig tool not.
* there are some issue with desktop fonts when nvidia driver is activated.

* Have to fix repository list, for some reason live version repository list are different from installed version (Cinnamon 16 has the same issue). 


Gnome (not available with Mint)
http://www.gnome.org/
https://www.youtube.com/watch?v=fVQjEtZAkPk&feature=c4-overview-vl&list=PLT98CRl2KxKESwFYdodPEZ42M38c40_3f
Looks better last realise, bud BIG NO! I don't like the idea!
Touch screen menu doesn't help you work
faster or easier on non touch screen PC!  
Gnome plans integrate all social web like facebook and etc... to desktop environment, I never going to be interested in that! 


XFCE
http://www.xfce.org/
I don't know yet... Have to read & see more...


P.S. "The thing that works for every case it actually does not work in any case!" OR "What is suitable for everything, often is good for nothing...".

The same menu for touchscreen and for non touchscreen PC is just stupid!
At least I did not see good one yet...  I believe it should be two different work modes. It would be great if they switch dynamically. Selecting the mode during installation it would be also not bad.

2013-10-05

Scheduled shutdown user friendly way with qZleep on Linux Mint

A simple tool scheduled shutdown in 24 hours. Perhaps you want to let finished same job for same time...
Or you like watch TV show in the bed and your brain

shutdown unpredictably... 
It is very unpleasant to wake up at night and then turn off everything...





Download Package
For Linux Mint and Ubuntu

Mirror: qzleep_0.1.0-4_amd64.deb
Mirror: qzleep_0.1.0-4_i386.deb


 qzleep_0.1.0-4_i386.deb
 qzleep_0.1.0-4_amd64.deb

tested on
 Mint 14 MATE
 Mint 15 KDE
 Ubuntu 12.04

Sources:

https://github.com/elektronas/qZleep.git



2013-08-06

Mail Client for Gmail - Firefox

Since Evolution mail & calendar is moved to new (Ubuntu) Gnome and
Debian squeeze version (which i really like) not available and also adapted version for Mint is not good...

Thunderbird - I used for half a year and its so bad that I never comeback to it...

I did not search very long for other mail apps but as I know that is pretty much all for Linux...
Except using browser, and obviasly google impruved web mail very much.
So I decided to try it out!

But!

I think and I state:  Email and Internet browsing - should not be together!

Notion that you browsing internet while logged in could lead
to many speculation what goes in background at that time...
I leave speculation  for others...
I'm just gonna avoid it.

So I work out the solution.


The solutions is simple, use two users. Run Firefox from some other user only for Gmail and Internet browsing leave to main desktop user.

My example is for Linux.
I believe it can be done for Windows Seven to, if You get the idea, follow link below:
sevenforums.com

Step 1:
For example my Deskotp user that i'm currently working on is called "user".
Create a new user "gmailclientfirefox", from grapical inteface "Users and Groups", set password and etc.

Step 2:
Create script file "gmail.bash"

su --login -c "/usr/bin/firefox" -s /bin/sh gmailclientfirefox


To be secure I set file permissions read&execute for owner only

-r-x------ 1 user user   382 Aug  5 23:41 gmail.bash


Set sudo exception for the script or in other words allow run script without password:

Add line at the end of the file "/etc/sudoers"

user ALL = NOPASSWD: /path/to/gmail.bash


Step 3:
Create launcher:
Find & download png image for gmail launcher icon.



Double click launcher. Go to gmail & log in. If you done working with email just close the window.
Second time just double click again and there is your mail!


I added launcher next to menu:




To not confuse which Firefox for Internet browsing and which is for Gmail
I change Firefox settings, remove all the top menu bars.
It looks like this:





I'm a Firefox fan, so I did it with Firefox. Google chrome have one advantage, there are some feature - can access mail even offline, did not try.