Quick bash script to check if a volume is mounted

Category: tips Tags: linux mount volume

A quick and dirty little bash script to check if a mount point is active or not.

if grep -qs '/mnt/drive1' /proc/mounts; then
    echo "It's mounted."
    echo "It's not mounted."

You can easily change the code to automatically mount the volume (or unmount) as per your needs.

Installing Glances on Debian

Category: tips Tags: linux glances sysadmin monitor

Glances is a cross-platform curses-based system monitoring tool written in Python. It shows a large amount of information such as cpu usage, memory usage, hardware monitoring, battery monitoring and much more.

Install the required dependencies:

sudo apt-get install python-dev python-jinja2 python-psutil python-setuptools hddtemp python-pip lm-sensors
sudo pip install batinfo pysensors

If you are running on actual hardware (ie: not a vps like many of my servers), you should detect the sensors for that part of the monitoring:

sudo sensors-detect

Now install the actual Glances program:

sudo pip install Glances

And finally, you can run it by simply:

sudo glances

To upgrade, you can do pip install —upgrade Glances

There are also a number of other optional dependencies you can install:

bottle (for Web server mode)
py3sensors (for hardware monitoring support) [Linux-only]
hddtemp (for HDD temperature monitoring support) [Linux-only]
batinfo (for battery monitoring support) [Linux-only]
pymdstat (for RAID support) [Linux-only]
pysnmp (for SNMP support)
zeroconf and netifaces (for the auto discoverer mode)
influxdb (for the InfluxDB export module)
statsd (for the StatsD export module)
pystache (for the action script feature)
docker-py (for the Docker monitoring support) [Linux-only]

Streamus - Play music from Youtube

Category: tips Tags: google chrome youtube music extension

Streamus is an interesting Chrome extension that allows you to play music from Youtube very easily & quickly.

You can search for music, create playlists, and play songs without having to have a tab open to Youtube. It also has a radio mode (think Spotify or Pandora) as well for finding music and keeping it playing without much attenion being paid to it. Additionally, there are keyboard shortcuts available as well to make it very easy to adjust the extension quickly.

There is a large list of features the author intends to implement such as Soundcloud, last.fm and much more.

Reddit thread from the author - http://www.reddit.com/r/Music/comments/2sypcn/seven_months_ago_i_showed_rmusic_my_software/

Subreddit for the extension - http://www.reddit.com/r/streamus

Official website - https://streamus.com/

Quick link to install - https://chrome.google.com/webstore/detail/streamus/jbnkffmindojffecdhbbmekbmkkfpmjd/

How to install Plex Media Server on Debian Squeeze or Wheezy

Category: tips Tags: plex debian media server htpc

Plex Media Server is a great server for playing media (tv, movies, pictures) on a variety of devices (Android, Roku, Smart TVs, Windows, Mac, IOS, etc). It supports transcoding, a very nice interface layout, tracks what episodes or movies you have already watched, share with your friends and with a plus pass (paid account) there are additional features as well such as sync so your device can sync when you are at home and let you play when you are mobile without using data to watch.

There is a third party repo that seems to be updated quite often (as of this article anyway) for Debian Squeeze and Wheezy. To use it, the instructions are pretty simple:

sudo apt-get install curl
echo "deb http://shell.ninthgate.se/packages/debian squeeze main" | sudo tee -a /etc/apt/sources.list.d/plexmediaserver.list
sudo curl http://shell.ninthgate.se/packages/shell-ninthgate-se-keyring.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install plexmediaserver

Your server should now be installed and functional. The default port is 32400 for the web interface, so to manage it you can go to (change your ip as needed) and add in your media files. Have fun :)

How to use loopback addresses other than with OSX

Category: tips Tags: osx 127 loopback

Strange little thing I encountered a while back. Basically, I use ssh tunnels to a number of remote hosts and to organize it a bit easier, I tend to use 127.0.0.X and assign each server a different number. However, under OSX you cannot use any others except for

The fix isn’t too bad though, you basically need to add the interfaces either manually or at startup.

To add just a few, you can do:

sudo ifconfig lo0 alias up

and change 2 to whatever ip you need. However, if you want to add a large number or all of the possible ones, this will take a long time. So, a quick little script to do it would be something like:

for ((i=2;i<256;i++))
   sudo ifconfig lo0 alias 127.0.0.$i up

You could also change the 256 to something else like 50 if you don’t want the full list added.