#!/bin/sh

# Simple hack to wait for systray to be present
# Exec tool if not already runned by session manager
# Do not uses pgrep --count, Linux only
cnt=$(pgrep -a -u "${USER}" -f "TermideskAgentUser" | wc -l)
if [ ${cnt} -le 2 ]; then
    sleep 5
    exec /usr/bin/termidesk-agent-user
fi