mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 02:30:39 +08:00
Merge pull request #1170 from grncdr/add-osx-launch-agent
Add an OSX LaunchAgent plist
This commit is contained in:
5
misc/launchd/README.md
Normal file
5
misc/launchd/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
# ipfs launchd agent
|
||||
|
||||
A bare-bones launchd agent file for ipfs. To have launchd automatically run the ipfs daemon for you, run `./misc/launchd/install.sh`
|
||||
|
||||
Note that the `ipfs` binary must be on the *system* PATH for this to work. Adding a symlink in /usr/bin works well enough for me.
|
23
misc/launchd/install.sh
Executable file
23
misc/launchd/install.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
src_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
plist=io.ipfs.ipfs-daemon.plist
|
||||
dest_dir="$HOME/Library/LaunchAgents"
|
||||
IPFS_PATH="${IPFS_PATH:-$HOME/.ipfs}"
|
||||
escaped_ipfs_path=$(echo $IPFS_PATH|sed 's/\//\\\//g')
|
||||
|
||||
mkdir -p "$dest_dir"
|
||||
|
||||
sed 's/{{IPFS_PATH}}/'"$escaped_ipfs_path"'/g' \
|
||||
"$src_dir/$plist" \
|
||||
> "$dest_dir/$plist"
|
||||
|
||||
launchctl list | grep ipfs-daemon >/dev/null
|
||||
if [ $? ]; then
|
||||
echo Unloading existing ipfs-daemon
|
||||
launchctl unload "$dest_dir/$plist"
|
||||
fi
|
||||
|
||||
echo Loading ipfs-daemon
|
||||
launchctl load "$dest_dir/$plist"
|
||||
launchctl list | grep ipfs-daemon
|
27
misc/launchd/io.ipfs.ipfs-daemon.plist
Normal file
27
misc/launchd/io.ipfs.ipfs-daemon.plist
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
<key>Label</key>
|
||||
<string>io.ipfs.ipfs-daemon</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>ipfs</string>
|
||||
<string>daemon</string>
|
||||
</array>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>IPFS_PATH</key>
|
||||
<string>{{IPFS_PATH}}</string>
|
||||
</dict>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>{{IPFS_PATH}}/logs/stderr.log</string>
|
||||
<key>StandardOutPath</key>
|
||||
<string>{{IPFS_PATH}}/logs/stdout.log</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
Reference in New Issue
Block a user