Biên dịch
go build notification.go
Hướng dẫn
- Chép file
notification.init.d.centos
hoặcnotification.init.d.ubuntu
vào thư mục/etc/init.d/notification
. Sau đóchmod +x /etc/init.d/notification
- Tạo folder chứa chương trình
mkdir -p /opt/notification
- Cấu trúc thư mục
.
├── config.json # Lưu thông tin cấu hình
├── users.sqlite # Lưu thông tin của user
└── notification
- Chép file
login-notify.sh
vào trong/etc/profile.d/login-notify.sh
của server nào cần monitor. - Khởi động dịch vụ
notification
Thông tin cấu hình
"SMTP_EMAIL": "",
"SMTP_PASSWORD": "",
"SMTP_SERVER": "",
"SMTP_PORT": 25,
"SMS_API": "",
"SMS_USER": "",
"SMS_PASSWORD": "",
"LISTEN": ":8080",
"DEFAULT_EMAIL": "",
"DEFAULT_FULLNAME": "",
"DEFAULT_PHONE": "",
"TIME_START_WORK": 8,
"TIME_STOP_WORK": 18,
"DB_PATH": "./users.sqlite"