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
- Host: GitHub
- URL: https://github.com/juanico10/hellosystemboot
- Owner: juanico10
- License: gpl-3.0
- Created: 2021-12-08T17:35:14.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-05-11T20:12:34.000Z (almost 2 years ago)
- Last Synced: 2025-02-13T08:23:58.666Z (12 months ago)
- Topics: boot, hello, script, shell-script, system, telegram
- Language: Shell
- Homepage:
- Size: 108 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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:
- Chat_ID: 

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: 
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: 
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!