An open API service indexing awesome lists of open source software.

https://github.com/juanico10/hellosystemboot

Send message notification Telegram on boot
https://github.com/juanico10/hellosystemboot

boot hello script shell-script system telegram

Last synced: 10 months ago
JSON representation

Send message notification Telegram on boot

Awesome Lists containing this project

README

          

# Enviar notificación al Telegram del arranque del sistema
Para poder recibir los mensajes en el Telegram, debes obtener el Token y chat_id de tu bot de telegram, puedes solicitarlos aquí desde la App de Telegram:
- Bot token: Link
- Chat_ID: Link

![alt text](https://github.com/JuanRodenas/HelloSystemBoot/blob/main/hellotelegram.png)

Empezamos a instalar el bot de inicio. Para que funcione necesita permisos, por lo que instalar en el usuario ROOT:
### Instalar los paquetes y actualizamos el sistema
~~~~shell
sudo apt update && \
sudo apt upgrade -y && \
sudo apt install curl -y
~~~~

### Edita el archivo hello.service para cambiar la ruta donde tienes el script hello.sh

Pueden descargar el archivo del servicio directamente del link: Link


Modificamos el archivo para añadir la siguiente ruta, donde irá el hello.shcode>:


Podemos modificar el tiempo (en segundos) el retraso en ejecución:

~~~~shell
ExecStartPre=/bin/sleep 60
ExecStart=/usr/bin/bash /root/scripts/hello.sh
~~~~
### Copiar el archivo hello.service y asignarle los permisos 0644
~~~~shell
cp hello.service /etc/systemd/system/ && \
chmod 0644 /etc/systemd/system/hello.service
~~~~
### Restart service, and enabled
~~~~shell
systemctl enable hello.service && \
systemctl start hello.service && \
systemctl daemon-reload
~~~~
### Edita el script hello.sh, para añadir tu token de bot, y tu chat_id, renombra el script elegido a hello.sh

Pueden descargar el archivo del script directamente del link: Link


Modificamos el archivo hello.sh y modicamos lo siguiente:

~~~~shell
TOKEN_BOT="YOUR_TOKEN_BOT"
TOKEN_ID="YOUR_TOKEN_CHAT"
~~~~
### Asigna los permisos a+x
~~~~shell
chmod a+x /root/scripts/hello.sh
~~~~
### Ready!