Auto Staring btsync (Bit Torrent Sync) / SyncApp on CentOS

I used to use this software, and wanted to share the init script I’ve been using:

#!/bin/bash
#
# Super ultra basic startup script for btsync
#
# chkconfig: 345 55 25
# description: bittorrent sync
# processname: btsync
# pidfile: 
# config: 

# Source function library
. /etc/init.d/functions

# Get network config
. /etc/sysconfig/network

if [ -f /etc/sysconfig/btsync ]; then
 . /etc/sysconfig/btsync
fi

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 1

if [ ! -f $BIN ] ; then
 echo "missing binary: $BIN" 
 exit 1;
fi

if [ ! -f $CONF ] ; then
 echo "missing configuration: $CONF" 
 echo "run $BIN --dump-sample-config to create a default configuration"
 exit 6;
fi

if [ -z $USER ] ; then
 USER=root
fi

start() {
 DIR=$(dirname "${PID}")
 if [ ! -d "$DIR" ] ; then
 mkdir $DIR
 fi
 daemon --pidfile $PID --user $USER $BIN --config $CONF
 echo_success
}

stop() {
 killproc -p $PID $BIN
}

case "$1" in
 start)
 start
 ;;
 stop)
 stop
 ;;
 restart)
 stop
 start
 ;;
 status)
 status -p $PID $BIN
 ;;
 *)
 echo "usage: $0 {start|stop|restart|status}"
 ;;
esac
exit 0;

And then the /etc/sysconfig/btsync

# SyncApp Settings
# USER=syncapp
CONF=/etc/btsync.conf
BIN=/usr/sbin/btsync
PID=/var/run/btsync/btsync.pid

Auto staring PlexConnect on CentOS

With AppleTV 4 we are getting a native Plex client, but some people are still using PlexConnect as it works, and is very stable.

Some time ago I create a very simple init script to start, stop and update PlexConnect:

#!/bin/sh
#
### BEGIN INIT INFO
# Provides: PlexConnect
# Required-Start: $network $local_fs
# Required-Stop: $local_fs
# Default-Start: 3 5
# Default-Stop: 0 1 6
# Short-Description: starts PlexConnect
# Description: starts PlexConnect
### END INIT INFO

# Source function library.
. /etc/init.d/functions
. /lib/lsb/init-functions

if [ ! -f /etc/sysconfig/PlexConnect ] ; then
 echo "/etc/sysconfig/PlexConnect missing!"
 exit 0;
fi

. /etc/sysconfig/PlexConnect

## Variables
#USER=root
#PROG=PlexConnect
#LOCKFILE=/var/lock/subsys/$PROG
#HOMEDIR=/srv/$PROG
#PIDFILE=/var/run/$PROG.pid
#PYTHON=/usr/local/bin/python2.7

start() {
 # Check for already running
 if status $PROG > /dev/null ; then
 echo "$PROG (pid `pidofproc -p $PIDFILE $PROG`) is running..."
 exit 0;
 fi
 # Start daemon.
 echo -n "Starting $PROG: "
 cd $HOMEDIR
 screen -dmS $PROG $PYTHON $PROG.py $OPTIONS
 RETVAL=$?
 if [ $RETVAL -eq 0 ] ; then
 PID=`screen -ls | grep PlexConnect | awk -F'.' '{print $1}' | tr -d '\t'`
 echo $PID > $PIDFILE
 log_success_msg ""
 else
 log_failure_msg ""
 fi
 [ $RETVAL -eq 0 ] && touch $LOCKFILE
 return $RETVAL
}

stop() {
 echo -n $"Shutting down $PROG: "
 killproc -p $PIDFILE $PYTHON
 RETVAL=$?
 if [ $RETVAL -eq 0 ] ; then
 log_success_msg ""
 else
 log_failure_msg ""
 fi
 [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
 return $RETVAL
}

update() {
 echo "Updating $PROG"
 cd $HOMEDIR
 git pull 
}


# See how we were called.
case "$1" in
 start)
 start
 ;;
 stop)
 stop
 ;;
 status)
 status $PROG
 ;;
 restart|force-reload)
 stop
 start
 ;;
 try-restart|condrestart)
 if status $PROG > /dev/null; then
 stop
 start
 fi
 ;;
 update)
 RESTART="FALSE"
 if status $PROG > /dev/null; then
 stop
 RESTART="TRUE"
 fi
 update
 if [ "$RESTART" = "TRUE" ] ; then
 start
 fi
 ;;
 reload)
 exit 3
 ;;
 *)
 echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload|update}"
 exit 2
esac

It will require /etc/sysconfig/PlexConnect:

# PlexConnect Settings
USER=root
PROG=PlexConnect
LOCKFILE=/var/lock/subsys/$PROG
HOMEDIR=/srv/$PROG
PIDFILE=/var/run/$PROG.pid
PYTHON=/usr/local/bin/python2.7
OPTIONS=""

(PlexConnect like Python 2.7)

Could probably be made smarter, but it works for me.


OSX Yosemite keeps appending “(2)” to computer name

I’m a perfectionist with something, like if I give my computer a name then I expect it to be that name, and not some random thing, or be modified by the system. Especially with OSX TimeMachine this is important as the filename (bundle) depends on the computername.

It looks like Yosemite have a small issue, where it will add (2), (3), … (x) to the computername, there are many ideas about what is causing it, and also how to fix it.

Luckyly enough someone posted a possible solution on Macrumors with a fix which looks to be working;

Go to Macintosh HD > Library > Preferences > SystemConfiguration
and delete the following files:

com.apple.airport.preferences.plist
NetworkInterfaces.plist
preferences.plist

Then reboot.

The deleted files will be recreated and you should be good to go.

One small thing with this is that one will lose all saved wifi passwords…

Update; Nov. 2. 2014:
No it does not fix the problem, on one of my notebooks (MacBook Air), it just came back. Crap!!!! Apple please fix this issue as soon as possible.

Update; Nov. 4. 2014:
Could be that this is only see with Wifi, and with Apple based AP’s (Airport Extreme, Airport Express, etc.), and that rebooting them solves the issue. I have not seen the issue after rebooting my Airport Extreme.


Angry as a life philosophy

Sooo, I decided to do things in the wrong order, and only figured it out after I’d done it, and then it was too late – as with most things in my life …

I stopped smoking (maybe I’ll let the world know how I feel about specific thing), but I had all the symptoms as most people who give up their lifeline to sanity; eating (bring it on), not too happy with anything, and in general just a pain in the bottom for a few months (I’m amazed that I still have a job, but hey I tried).

Now after not having my life extension between my fingers every 1 hour (on avg.) during waking hours left some space which needed to be filled with other things, and as I’ve always been quite outspoken about stupidity I decided to get Angry with stupidity.

Like; why the f… can’t you figure out not to throw your cigaret buds on the street, or don’t throw you Mac D. wrap paper on the street, shithead. Stuff like that, and what I found is that I actually don’t get along with most people in the world. Actually I do get along with the world, but as the world is so filled with stupidity it’s amazing that we as a species have survived this long…

So most people would probably say that I should chill and relax… right read about the Great Pacific Garbage Patch, it mostly exist because people just throw plastic (cans, bags, dipers, etc.) over their left or right shoulder instead of disposing of it in a secible way. Or an article I read some time ago which stated that if you eat more than 170g of Tuna (or salmon/laks) every week then there is a risk that you will die from heavy metal poisoning (Japan will cease to exist in the near future). Not saying that you should eat Tuna anyway as there aren’t too many of them left.

Then it comes to behaviour towards other people, everyday I’ll see people who will J-walk, and give cars the finger if they honk at them … hey you should know better. Or if I hit a bicyclist who is running a red light then it’s my fault automatically as I should know that the Darwin Award would do that.

So yes, I’m angry as I know that most people actually have a brain, and should know better, but they are too lazy or don’t give a hoot about what happens around them – that really pisses me off.

Only thing which is worse than all of this are inconsiderate people …

And after been angry for months I actually am a lot better … the world is unfortunately still stuffed with too many stupid people.


Are Danish Embassies actually Danish ?

On Facebook, the group for Danes in The Netherlands shared a job opening for a chauffeur at the Danish Embassy in Den Haag, The Netherlands.

New Colleague
05.08.2014 10:31
We are looking for a new driver.
We are looking for a driver with driver certificate CCV-D1, who also is expected to take care of administrative and practical tasks in the embassy and in the residency of the ambassador in The Hague.

Flexibility, loyalty and reliability are important aspects in the choice of our new presentable colleague. Some experience is desirable.

It concerns a full-time job. Working hours also in the evening and during the weekends according to agreement.
Working languages: English and Dutch.
Start: as soon as possible.

I read it and stopped at “Working languages: English and Dutch.”, no mentioning of Danish. I would expect that Danish would be a required language, in addition to English and Dutch. So just to have a go at it, and send an email to Dansk Folkeparti (the most right wing party in the parliament, and one would expect them to be very much on top of something like this, but), and was told that there are not requirements for Danish as a work language on the Danish embassies. What!!!, hey, hang on a second. So as a Danish citizen calling a Danish embassy I can be forced to speak English, or a local Language to be able to communicate with people on the Embassy, until I get to the officials from Denmark, like the ambassador, or maybe the military attache, of similar officials.

Then I contacted Venstre (liberal, largest party with seats in the Parliament), and was told to contact the foreign Ministry of Foreign Affairs, as they are responsible for the Danish Embassies … that was not what I was trying to get out of this.

As a Danish Citizen, I am very disappointed that I have to speak a foreign language to communicate with people who work at the Embassies of my home Country. And if I by chance get to talk to someone who speak Danish then I should be happy.

I called the Danish Embassy in Den Haag in 2001, the person who picked up the phone spoke English, I asked politely if I could speak Danish … the answer was “No!!!”, I apologized and hanged up…


Opinions without substance

I’ve always been told to make sure that I do my best to know the background before I comment complain about something (the weather is exempt). But with the introduction of Facebook we now have “amateur” specialists, who will “like”, “share” etc., anything which they think make any sence. Unfortunately it is not only the “amateur” specialists on Facebook which do this, also Journalists who write for previously recognized broadsheet papers have started to do this, which means that we cat opinions without substance.

I quite often (until I dis-friended them), got forwarded (shared) information about animal rights on Facebook, though being interesting, but the information in general terms came from fanatical people who only have one reason in publicizing this information; to tell other people what they SHOULD think, there is no room for creating ones own opinion, nor to criticize their opinion – it’s very much; either you’re with us, or you’re against us. Not saying that the people who shared the information with me where fanatically, but I sometimes think that taking what other people write is easier than to sit down and research the subject and then write something else – which can cause people to like or share things which they might not agree with when they are questioned about it. And it also makes me comment and question the shared material….

We have always, as far as I can understand, had fanatical people, the problem is that in todays society it is too easy to agree with them without actually having to understand what they talk about, and it is too easy for them to spread their “broadcast”.

Remember before you “like” or “share” contents that knowing what it’s about might teach you something, and maybe you’ll choose something else….


Klim D30 Armor ….

Bikers, are a stange group of people, we will happily spends large amount of money on things which other people tell us is the right stuff … I remember years ago, everyone had the buy Rukka (most still do), then and now it is Klim, both of them have been bought up by large corporations. And on the sideline one finds Stadler (the last of the big ones), then of the “B” like there are companies like RevIT, Alpinstarts, and so one. We are not discussing clothing for fast bikes, this is the “real” stuff for the traveler who wants to go and see the world.

Now as usual I’ve listened to the wrong people, and ended up with something which I should not have spend money on….

First back in February I decided to get an Klim Overland Jacket, as everyone rave about the price / quality, it did not fit me at all, and due to the wonderful customer service from where I got it from I could not return it (I was stupid enough to drive 35km with it on), which cost me 50% of the price – as funny enough no one else was interested in buying it … hummmm….

But as I really needed a new jacket, and my favorite; Stadler Tour was too expensive (+1100€), I decided to try with a Klim Latitude, which is a very nice jacket, which comes with the right amount of pockets, almost the right amount of ventilation (very few do – read; Stadler), and I was happy.

Now a few weeks back I was on my way to HUM Germany, and due to a brain fart I ended up face down on the asphalt sliding a few meters, which I would expect would not be a big problem. Ok, it did hurt like a bitch, but I was ok, my right leg took most of the impact, but my crap boots and trousers (BMW with good protection) left me with a black n’ blue leg, but otherwise ok.

The problem was (is) my right arm …. now back to a few facts;

– Klim only provide D3O Level 1 armor in their jackets (even Overland is only an upgrade, but still level 1).

– D30 is impact resistant
– D30 is NOT abrasive resistant

This means that if it hist something it will dispert the power of the impact, but when you slide over a surface it can fold up and not give any protection. That is a massive issue, as most of the problems comes from sliding ….

Our skin is made up of 5 layers, and my “small” spill where I landed with my arm underneath my body, the D3O albow proctetion folded up or slid away and did not provide any proction to my arm and the layer of skin which sits ontop of the muschle has lost the connecton to the muschle … this is reasonable painful… and according to my doctor who does diagnostics from the other side of the table this will eventually heal…. (do not get me started on Dutch Doctors – all of them)

But I have a used Stadler Jacket (which is too small) which comes with Level 2 back protection and hard shell shoulder and elbow protectors … so I could just move them across. Nop, no such luck, Klim’s pockets for protectors are too small.

So now I have a very nice jacket which looks like it should do, but it scares the living daylights out of wearing as there is practically no protection in it.

So what is it with a company like Klim, for me it looks like we’re all stupid enough to believe what they tell us – ie. they use the best possible proctors; they do not – they are the cheapest one can get from D3O, they have the best warranty; actually if the garment have been close to the ground at any speed they might refuse any warranty claims, lucky enough Gore-Text will help out. Most of their cloth fit like it was made for a cow, but we’re still happy to buy it, which I do not understand – we much be stupid.


Follow

Get every new post delivered to your Inbox.