tl,dr: `systemctl suspend`

Sometimes I let my pc play music at night. Spotify still didn’t manage to implement a sleep function (even gorram Audible has this – and chances are the app crashes way before anyway).

I usually use `shutdown -h 60` or similar. Suspend tho? That’s another story. Hint: “suspend” is a bash builtin and not what you’d expect 😉

Looks like this changed (again) from `pm-suspend` to
 systemd:

> sleep 1h; systemctl suspend

No sudo. yw.

Did you know `ncdu`? I’m using this for years to find out where all my precious disk space is lost. Unlike other solutions it works in a terminal and this way even on remote servers
 or gorram mobile phones always short on anything.

Having trouble with your recently updated Zarafa 7.2 installation? Can’t connect via imap? Seeing something like this in your gateway log?

CreateProfileTemp(): ConfigureMsgService failed 80040115: network error

You already make sure that

* your zarafa-server binds to 0.0.0.0
** server_bind = 0.0.0.0
** server_tcp_enabled = yes
* your gateway points to localhost
** server_socket = http://localhost:237/zarafa

And your config worked just fine before? Still have no idea what’s going on? Well, take a look at lsof -i tcp:236 and notice that you’ll only get TCP *:237 (LISTEN) on IPv4 for the zarafa-server.

Now check your ifconfig lo for inet6 entries:

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask>:255.0.0.0
inet6 addr: ::1/128 Scope:Host

And your /etc/hosts will probably point to this as well:

127.0.0.1 localhost.localdomain localhost
::1 localhost

So this is what happens: zarafa-gateway looks up localhost, reads IPv6, tries to connect to ::1 port 237 and gets nothing. Here is your 0x80040115 (MAPI_E_NETWORK_ERROR) network error.

Use server_socket = http://127.0.01:237/zarafa and you’ll be fine.

Well done Zarafa. How about binding to IPv6 as well? Nothing in the manpage on this. Don’t tell me that the server isn’t IPv6 ready while the gateway is.

#80040115

Hint: Do *never* use the UNIX socket as server_socket in the zarafa-gateway config. You may open login to the accounts without valid password if you do so. Check the manual. Seriously.

This is how I import my deadlines for tickets from our Jira bugtracker to our Zarafa ical gateway (running on localhost only but since I’ve a real account I could easily install a crontab for this for my system user).

Notes:

– The script makes use of phyton as well
– The script makes use of the Jira rest api (needs to be enabled)
– The script makes use of the (free) JIRA Calendar Plugin (https://marketplace.atlassian.com/plugins/com.atlassian.jira.ext.calendar/versions#b20107)
– The script uses a hardcoded filter id 10100. The filter must be created by the Jira user before. In my case it’s simply a filter that returns all projects I’m assigned to.
– The calendar used (e.g. “Jira”) must be manually created by the Zarafa user before and will be overwritten everytime the script runs! (Do not use default calendar)
– Dunno how to check whether ICS file loaded fine so run it manually and check whether new items show up in the calendar 🙂

It can probably easy adapted to other ics servers as well. I run this all 15 minutes during working days making use of crontab.


#!/bin/bash
JIRAUSER="changeme"
JIRAPASS="changeme"
JIRAICS="$HOME/jira.tmp.ics"
JIRAURL="jira.example.com"
#secure folder with e.g. umask 077
JIRACOOKIE="$HOME/.cookies/jira.cookie"
ZARAFAUSER=="changeme@example.com"
ZARAFAPASS=="changeme"
#
#Do NOT use default "Calendar", ICS will OVERWRITE it!
#Create an OWN calendar for Jira entries ONLY!
#
ZARAFACALENDAR="Jira"
if [ -f "$JIRAICS" ]; then
rm "$JIRAICS"
fi
if [ ! -f "$JIRACOOKIE" ]; then
JIRATEST=`/usr/bin/curl -s -u "$JIRAUSER":"$JIRAPASS" --cookie-jar "$JIRACOOKIE" "https://$JIRAURL/rest/api/2/user?username=$JIRAUSER" -s | python -mjson.tool | grep -oP "(?<=\"name\": \")[^\"]+"`
else
JIRATEST=`/usr/bin/curl -s --cookie "$JIRACOOKIE" "https://$JIRAURL/rest/api/2/user?username=$JIRAUSER" -s | python -mjson.tool | grep -oP "(?<=\"name\": \")[^\"]+"`
fi
if [ "$JIRATEST" != "$JIRAUSER" ]; then
echo "Error getting Jira username $JIRAUSER"
rm "$JIRACOOKIE"
exit -1
fi
/usr/bin/curl -s --cookie "$JIRACOOKIE" --output "$JIRAICS" "https://$JIRAURL/plugins/servlet/calendar?searchRequestId=10100&dateFieldName=duedate&showVersions=true" || exit $?
if [ -f "$JIRAICS" ]; then
/usr/bin/curl -s -u "$ZARAFAUSER":"$ZARAFAPASS" -T "$JIRAICS" "http://localhost:8080/ical/$ZARAFAUSER/$ZARAFACALENDAR"
rm "$JIRAICS"
fi