#!/bin/sh

set e

#启动守护进程
count_of_fcitx=`ps -ef | grep -w /usr/bin/fcitx | grep -v 'grep' | wc -l `
count_of_daemon=`ps -ef | grep -w /usr/bin/huayupy-daemon-fcitx | grep -v 'grep' | wc -l`

if [ "$count_of_fcitx" -gt  "0" ] && [ "$count_of_daemon" -lt "1" ];then
   current_user=`w -h | awk '{print $1}' |uniq `
   for i in $current_user
   do
	   su - $i -c /usr/bin/huayupy-daemon-fcitx >/dev/null 2>&1 &
   done
fi
