Skip to content

Commit b609cec

Browse files
committed
Add plist file for launchd service
- revise README for new `setup/` folder
1 parent c42394a commit b609cec

File tree

5 files changed

+37
-3
lines changed

5 files changed

+37
-3
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,8 @@ cython_debug/
156156
server.pem
157157

158158
# Actual mapping file
159-
mapping.json
159+
mapping.json
160+
161+
162+
# Actual metrics file
163+
metrics.csv

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ There is a `mapping.json.template` file in the repository that you can rename to
2727

2828
### Setup Alfred workflow
2929

30-
Import the `go.alfredworkflow` package into alfred, you will need to purchase the powerpack
30+
Import the `setup/go.alfredworkflow` package into alfred, you will need to purchase the powerpack
3131

3232
### Setup `/etc/hosts` file
3333

@@ -85,4 +85,5 @@ If you are trying to open a shortlink that you have created eg: `test` from abov
8585
## Useful
8686

8787
1. There is a metrics logging file `metrics.csv` that logs the visit time of each shortlink with its corresponding destination domain
88-
2. You can configure the port, the mapping file, the metrics file, the prefix to create a new domain, as well as the path of the certificate file all through the `config.ini` file
88+
2. You can configure the port, the mapping file, the metrics file, the prefix to create a new domain, as well as the path of the certificate file all through the `config.ini` file
89+
3. This service can also be setup as a `launchd` service using the `setup/com.adityaarora.golinks.plist` file as reference. Ensure you change the `WorkingDirectory` as well as the `StandardOutPath` and `StandardErrorPath`. After that simply store the file in `/Library/LaunchDaemons` and then run `sudo launchctl load /Library/LaunchDaemons/com.adityaarora.golinks.plist` to load the service. The service should be started automatically, and if there are any issues you can inspect the log files you put in.

metrics.csv renamed to metrics.csv.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ datetime,shortlink,domain
1010
18/Dec/2021 21:00:09,test,https://example.com
1111
18/Dec/2021 21:00:17,test,https://example.com
1212
18/Dec/2021 21:01:06,test,https://example.com
13+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>Label</key>
6+
<string>com.adityaarora.golinks</string>
7+
8+
<key>LaunchOnlyOnce</key>
9+
<false/>
10+
11+
<key>KeepAlive</key>
12+
<true/>
13+
14+
<key>WorkingDirectory</key>
15+
<string>/Users/adityaarora/github/go-links/</string>
16+
17+
<key>ProgramArguments</key>
18+
<array>
19+
<string>python3</string>
20+
<string>main.py</string>
21+
</array>
22+
23+
<key>StandardOutPath</key>
24+
<string>/Users/adityaarora/logs/golinks.log</string>
25+
<key>StandardErrorPath</key>
26+
<string>/Users/adityaarora/logs/golinks.log</string>
27+
</dict>
28+
</plist>

0 commit comments

Comments
 (0)