https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html#//apple_ref/doc/uid/10000172i-SW7-BCIEDDBJ
https://medium.com/@chetcorcos/a-simple-launchd-tutorial-9fecfcf2dbb3
this sh file is locate at :/Users/sirius/ipfs_auto_restart.sh
to run this file once:
sh /Users/sirius/ipfs_auto_restart.sh
create this file:
sudo vim /Users/sirius/ipfs_auto_restart.sh
then, copy past below script
then
- Open the terminal application in Linux or Unix
- Next, open a file in vim / vi, type: vim filename
- To save a file in Vim / vi, press Esc key, type :w and hit Enter key
- One can save a file and quit vim / Vi by pressing Esc key, type :x and hit Enter key
---------------------
#!bin/bash
#Start only if it is not running
SERVICE="ipfs"
if pgrep -x > "$SERVICE" >/dev/null
then
"$SERVICE is running"
else
ipfs daemon
echo "$SERVICE stopped, but re-started...."
fi
------------------
======== create a plist file =================
sudo vim /Library/LaunchDaemons/com.ipfs.auto.restart.plist
copy below xml and past, then exit
- Open the terminal application in Linux or Unix
- Next, open a file in vim / vi, type: vim filename
- To save a file in Vim / vi, press Esc key, type :w and hit Enter key
- One can save a file and quit vim / Vi by pressing Esc key, type :x and hit Enter key
...............................................................................
Before run
ipfs add -r xxxx
must close all ipfs daemon from task manager
clean close all process.
get error:
siriuss-mini:~ sirius$ ipfs add -r /Volumes/original-1/fileRestAPI/Los_Angeles_County_Land_Records
Error: cannot connect to the api. Is the deamon running? To run as a standalone CLI command remove the api file in `$IPFS_PATH/api`
you have to go d:\ipfs_repo
to delete api file and repo.lock file,
because when you force quit ipfs desktop, those 2 file left un-closed,
you must manually delete them.
--------------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment