Не могу запустить sh файл при входе в учетную запись. Файл запускает прослушку порта и при поступлении сообщения запускает Kodi. Если в терминале запускаю через sudo все отлично работает. Не могу сделать чтобы автоматом грузился без ввода пароля админа под своим пользователем. Уже все что мог только опробовал.
Вот содержимое файла sh:
#!/bin/bash
UDP_PORT=5600 # Change this if you need to run this on a different port, just remember to update Yatse's settings$
RUN_XBMC_AS=yegor # Change this if you need to run it as another user
START_PHRASE="YatseStart-Xbmc" # Do not touch this, unless you know what you are doing...
# The following block checks if the user running this script has the required privileges to listen on the port specifie$
WHO=`whoami`
if [ "$WHO" != "root" ]; then
echo "Unprivileged users may not evesdrop on ports. Cannot start unless running as root."
exit 1
fi
export DISPLAY=:0
echo "Listening on port $UDP_PORT for Yatse remote start command"
while [ true ]; do
# Wait for a packet to come in from Yatse
LISTEN=`tcpdump -i any -n udp dst port "$UDP_PORT" -A -c 2 | grep -o "$START_PHRASE"`
# Make sure that we received the right command
if [ "$LISTEN" = "$START_PHRASE" ]; then
echo "Starting XBMC as $RUN_XBMC_AS"
# Start XBMC using sudo -u to run it using the username above
# If you need to you can replace the xbmc command below with xbmc-standalone if you are not using a window manager
sudo --user=$RUN_XBMC_AS kodi
fi
# Sleep, to be nice, for unwanted rogue processes writing to our port
sleep 1
done