-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge upstart fixes after more testing on RPi and Orange Pi (#7)
* Fixes for upstart (#6) * Send uninstall outputs to /dev/null
- Loading branch information
1 parent
d8a0824
commit d77046e
Showing
6 changed files
with
118 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Get init system used by OS (upstart, systemd, etc.) | ||
function get_init_system() { | ||
init_from_process=$(sudo ps -p 1 | tail -n 1 | cut -d ":" -f 3 | cut -d " " -f 2) | ||
|
||
[[ $init_from_process == *"systemd"* ]] && echo "systemd" && return 1 | ||
[[ $init_from_process == *"upstart"* ]] && echo "upstart" && return 1 | ||
|
||
[ -x "$(command -v dpkg)" ] && | ||
init_from_package_manager=$(sudo dpkg -S /sbin/init | cut -d ":" -f 1) || | ||
init_from_package_manager=$(sudo rpm -qf /sbin/init) | ||
|
||
[[ $init_from_package_manager == *"systemd"* ]] && echo "systemd" && return 1 | ||
[[ $init_from_package_manager == *"upstart"* ]] && echo "upstart" && return 1 | ||
|
||
return 0 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
description "IPFS daemon" | ||
|
||
env IPFS_PATH={{ipfs_path}} | ||
|
||
start on runlevel [2345] | ||
stop on runlevel [!2345] | ||
|
||
script | ||
echo $$ > /var/run/ipfs-daemon.pid | ||
exec /usr/local/bin/ipfs daemon | ||
end script | ||
|
||
pre-stop script | ||
rm /var/run/ipfs-daemon.pid | ||
end script | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
Description=IPFS daemon | ||
Wants=network.target | ||
After=network.target | ||
|
||
[Service] | ||
Type=simple | ||
Environment=IPFS_PATH={{ipfs_path}} | ||
ExecStart=/usr/local/bin/ipfs daemon | ||
ExecStop=/usr/bin/pkill -f ipfs | ||
Restart=on-failure | ||
RestartSec=10s | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters