Skip to content

Instantly share code, notes, and snippets.

@ayazzali
Last active November 3, 2018 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayazzali/a887f8c0aa347a121e94a01899c28b83 to your computer and use it in GitHub Desktop.
Save ayazzali/a887f8c0aa347a121e94a01899c28b83 to your computer and use it in GitHub Desktop.
or restart after killing

sudo nano /etc/rc.local

/home/ubuntu/afterRestart /usr/bin/dotnet /home/ubuntu/path_to_dll

supervisord

  • nano /etc/supervisor/supervisord.conf
  • and type at the end this:
[program:kai_worker]
directory=/root/FAQ_KAI_Bot
command=python3 start.py
;command=nohup python3 start.py >>/root/FAQ_KAI_Bot/log.txt 2>&1
stdout_logfile=/var/log/kai_worker.log
stderr_logfile =/var/log/kai_worker.log
autostart=true
autorestart=true
user=root
stopsignal=KILL
numprocs=1
  • do /etc/init.d/supervisor restart
  • to check status use command supervisorctl

create file /home/ubuntu/afterRestart.sh

create file /home/ubuntu/tg

https://api.telegram.org/bot4123123123:sdcjnasdcjnasdkcjasndkacsndkc/sendmessage?chat_id=180504111&text=restarted:

cd /home/ubuntu/
    cat tg > del
    curl checkip.amazonaws.com >> del
    cat del | tr -s '\r\n' ' ' > del2
    wget -i del2

or cron

[https://www.cyberciti.biz/faq/linux-execute-cron-job-after-system-reboot/] ...

or docker

get started for win8.1

  • make hyperv enabled
    • do extenal switch
  • type by admin
choco install docker -y
choco install docker-machine -y
choco install docker-for-windows -y
docker-machine create --driver hyperv default
docker-machine env
  • DO what the last line says!
  • Сheers!!! :) You can docker run --interactive --tty ubuntu bash