From 98fe1f17930bebc3970a052d5ff7ca4ce54d6110 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Fri, 1 Nov 2024 15:14:16 -0600 Subject: [PATCH] Add service file --- README.md | 5 +---- freepbx-stats.service | 13 +++++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 freepbx-stats.service 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