Add service file

This commit is contained in:
Christopher Cookman 2024-11-01 15:14:16 -06:00
parent 74b7a56e48
commit 98fe1f1793
2 changed files with 14 additions and 4 deletions

View file

@ -21,7 +21,4 @@ For anybody that's running this on their PBX directly, and used the above SQL se
Otherwise, you probably know how to configure it the way you need. Otherwise, you probably know how to configure it the way you need.
## Automatic running ## Automatic running
For LiteNet, we're using `crontab` to run this every day at midnight. Copy `freepbx-stats.service` to `/etc/systemd/system`, then run `systemctl enable --now freepbx-stats` to make it run in the background!
That looks a little something like this:
`0 0 * * * cd /root/freepbx-stats/ && /usr/bin/node .`
You can edit the crontab with `crontab -e`

13
freepbx-stats.service Normal file
View file

@ -0,0 +1,13 @@
[Unit]
Description=Daily Stats Bot
After=mariadb.service
[Service]
User=root
Group=root
WorkingDirectory=/root/freepbx-stats
ExecStart=/bin/node .
Restart=on-failure
[Install]
WantedBy=multi-user.target