Skip to content

Commit

Permalink
Added basic systemd service for launching MAUCacheAdmin
Browse files Browse the repository at this point in the history
systemd service that launches MAUCacheAdmin at boot and auto-restarts
if the service unexpectedly quits.
  • Loading branch information
Bryson Tyrrell committed Oct 26, 2016
1 parent 88f137e commit 371dec7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Expand Up @@ -4,3 +4,20 @@
Purpose: Downloads MAU collateral and packages from the Office CDN to a local web server</br>
Usage: MAUCacheAdmin --CachePath:<path> [--CheckInterval:<minutes>] [--HTTPOnly] [--NoCollateral]</br>
Example: MAUCacheAdmin --CachePath:/Volumes/web/MAU/cache --CheckInterval:60</br>

## maucache.service

A simple systemd server to launch MAUCacheAdmin at boot with a 15 minute interval and auto-restart upon a failure.

This service was written and tested on Ubuntu 16.04 using Nginx. The MAUCacheAdmin script is assumed to be located in `/usr/local/`. Update these values accordingly.

The `ExecStopPost` line has an optional mail command to notify an email address if the service stops. Remove this line if you do not wish to use this option.

To use this service write the `maucache.service` file to `/lib/systemd/system/` and run the following commands:

```
sudo systemctl enable maucache.service
sudo systemctl daemon-reload
sudo systemctl start maucache.service
sudo systemctl status maucache.service
```
12 changes: 12 additions & 0 deletions maucache.service
@@ -0,0 +1,12 @@
[Unit]
Description=Microsoft AutoUpdate Cache Admin Runner

[Service]
Type=simple
ExecStart=/bin/sh -c "/usr/local/MAUCacheAdmin --CachePath:/var/www/html --CheckInterval:15"
ExecStopPost=/bin/sh -c 'echo "The MAUCacheAdmin service has stopped: Automatic restart in 5 minutes." | /usr/bin/mail -s "MAUCacheAdmin Stopped" -a "From: MAUCacheAdmin <admin@maucacheserver>" you@your.org'
Restart=always
RestartSec=300

[Install]
WantedBy=multi-user.target

0 comments on commit 371dec7

Please sign in to comment.