metrics.sh/init.d/README.md

38 lines
1023 B
Markdown
Raw Permalink Normal View History

2015-03-28 10:06:31 -04:00
# Running metrics.sh as a service on Linux
Run the following commands as root:
```sh
2015-03-28 19:05:46 -04:00
# Install metrics.sh at /opt/metrics.sh
$ mkdir /opt; cd /opt
2015-03-28 10:06:31 -04:00
$ git clone https://github.com/pstadler/metrics.sh.git
$ cd metrics.sh
2015-03-28 19:05:46 -04:00
# Install the service
2015-03-28 10:06:31 -04:00
$ ln -s $PWD/init.d/metrics.sh /etc/init.d/metrics.sh
2015-03-28 19:05:46 -04:00
# Create a config file
2015-03-28 10:06:31 -04:00
$ mkdir /etc/metrics.sh && chmod 600 /etc/metrics.sh
$ ./metrics.sh -C > /etc/metrics.sh/metrics.ini
2015-03-28 19:05:46 -04:00
# At this point you should edit your config file at
# /etc/metrics.sh/metrics.ini
2015-03-28 10:06:31 -04:00
# Start service
$ service metrics.sh start
2015-03-28 19:05:46 -04:00
# If run with the default configuration where reporter is 'stdout', metrics
# will be written to /var/log/metrics.sh.log. Be aware that this file will
# grow fast.
$ tail -f /var/log/metrics.sh.log
2015-03-28 10:06:31 -04:00
# Stop service
$ service metrics.sh stop
2015-03-28 19:05:46 -04:00
# Check service status
$ service metrics.sh status
2015-03-28 10:06:31 -04:00
2015-03-28 19:05:46 -04:00
# Automatically start service when booting and stop when shutting down
2015-03-28 10:06:31 -04:00
$ update-rc.d metrics.sh defaults
2015-03-28 19:05:46 -04:00
# Disable automatic starting/stopping
2015-03-28 10:06:31 -04:00
$ update-rc.d -f metrics.sh remove
```