Skip to content

Instantly share code, notes, and snippets.

@tak1827
Created July 11, 2019 10:42
Show Gist options
  • Save tak1827/1e43896d0dbc2e310614510755654e9a to your computer and use it in GitHub Desktop.
Save tak1827/1e43896d0dbc2e310614510755654e9a to your computer and use it in GitHub Desktop.
#!/bin/sh
# **************************************************
# IPFS Pinning Script
# **************************************************
# arg.1 start index for loop
# arg.2 end index for loop
# **************************************************
# Constants
PINNING_FILE_PATH="./bancor_recent_trading_logs.txt"
PINNED_FILE_PATH="./pinned_list.txt"
# Variables
start_index=${1}
end_index=${2}
# Arguments number check
if [ $# -ne 2 ]; then
echo "Specified argument number is $#"
echo "Must spesify 2 arguments"
exit 1
fi
######################
# Main
######################
echo "************* Start ${0##*/} *************"
for i in `seq $start_index $end_index`
do
# Replace 1st line as index number
sed -i "1s/.*/${i}/g" $PINNING_FILE_PATH
ipfs add $PINNING_FILE_PATH >> $PINNED_FILE_PATH
usleep 100000
done
echo "************* End ${0##*/} *************"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment