https://github.com/tangruize/site-monitor
I don't want to miss any news about u.
https://github.com/tangruize/site-monitor
Last synced: 3 months ago
JSON representation
I don't want to miss any news about u.
- Host: GitHub
- URL: https://github.com/tangruize/site-monitor
- Owner: tangruize
- Created: 2020-08-20T06:50:31.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-31T05:12:00.000Z (almost 5 years ago)
- Last Synced: 2025-01-07T20:42:07.364Z (5 months ago)
- Language: Shell
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Site Monitor
I don't want to miss any news about the websites I'm interested in.
So I write a script to monitor changes to those sites.The idea is very simple:
- wget site.html
- git add && git commit
- if git commit succeeds, notify me!This script only works on Linux, but it can be easily implemented on other platforms.
I am not intended to make it portable.## Dependency
The script uses `git`, `notify-send` and `wget`.
```bash
sudo apt install libnotify-bin # for notify-send
```## Usage
I want to get latest news of [NJU CS](https://cs.nju.edu.cn/).
```bash
./site-monitor.sh https://cs.nju.edu.cn/1654/list.htm
```Running this cmd will create a directory named `@cs.nju.edu.cn@[email protected]`.
The directory name is the site url after replacing starting `@` with `https://` and other `@` with `/`.Then run `./site-monitor.sh` will check all sites in the script directory.
I want to monitor [LAMDA publication list](http://www.lamda.nju.edu.cn/CH.Pub.ashx).
However, it is a dynamic page and every time re-run `./site-monitor.sh` will send a notification.
Just use `git log -p` to observe the differences and write a `rules.sh` to delete volatile lines:```bash
./site-monitor.sh http://www.lamda.nju.edu.cn/CH.Pub.ashxcat << EOF > [email protected]/rules.sh
sed -i '/hidden/d' CH.Pub.ashx
EOFchmod +x [email protected]/rules.sh
```## Schedule
Better use with cron.
I schedule it every hour.
And here is my crontab:```crontab
# m h dom mon dow command
0 * * * * /path/to/site-monitor.sh
```You can also set it to start automatically when login:
```bash
cat << EOF > "$HOME/.config/autostart/site-monitor.desktop"
[Desktop Entry]
Type=Application
Exec=bash -c 'sleep 30 && `realpath site-monitor.sh`'
Name=site-monitor
Hidden=false
X-GNOME-Autostart-enabled=true
Comment=Monitor websites and notify the latest news
EOF
```## Disclaimer
Since it uses git, histories are saved.
You should respect the privacy of the website owner.