Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
telegram-daemon
#! /bin/sh
### BEGIN INIT INFO
# Provides: telegram-daemon
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: telegram daemon
# Description: telegram daemon
### END INIT INFO
# actions
case "$1" in
start)
echo "Telegram daemon is starting..."
su tatsch -c '/opt/tg/bin/telegram-cli -vvvvRC -k tg-server.pub -W -dL /var/log/telegram-daemon/telegram-daemon.log -P 2391 &'
echo "...done"
;;
stop)
echo "stopping telegram daemon..."
sudo pkill telegram
echo "..done"
;;
restart)
echo "stopping telegram daemon..."
sudo pkill telegram
echo "..done -- restarting..."
su tatsch -c '/opt/tg/bin/telegram-cli -vvvvRC -k tg-server.pub -W -dL /var/log/telegram-daemon/telegram-daemon.log -P 2391 &'
echo "...done"
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment