diff --git a/README.md b/README.md index c0daa4b..a3beeb5 100644 --- a/README.md +++ b/README.md @@ -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. ## Automatic running -For LiteNet, we're using `crontab` to run this every day at midnight. -That looks a little something like this: -`0 0 * * * cd /root/freepbx-stats/ && /usr/bin/node .` -You can edit the crontab with `crontab -e` \ No newline at end of file +Copy `freepbx-stats.service` to `/etc/systemd/system`, then run `systemctl enable --now freepbx-stats` to make it run in the background! \ No newline at end of file diff --git a/freepbx-stats.service b/freepbx-stats.service new file mode 100644 index 0000000..642a20b --- /dev/null +++ b/freepbx-stats.service @@ -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 \ No newline at end of file