yurilaaziz / neo-instabot

Neo-Instabot is a free project. Forked from instabot.py. It uses the Instagram Web/Mobile API.
Other
37 stars 22 forks source link

Start script #27

Closed alessandro893 closed 4 years ago

alessandro893 commented 5 years ago

I want to share my instabot start script (just edit few strings, and rename script to "instabot"):

!/bin/sh

login="--login YOURLOGIN" pass="--password YOURPASS" config="-c /PATH-TO/instabot.config.yml" session="/PATH-TO/YOUR.session" instabot="/opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin/instabot-py -v" python="/opt/local/bin/python3.7"

pid=$(ps -ax | grep instabot | grep py | awk '{ print $1 }') kill="/bin/kill"

if (test "$1" = "--kill") || (test "$1" = "-k") then if (test "$pid" > "0") then $kill $pid echo pid "$pid" - stopped exit else echo no pid, already stopped exit fi fi

if (test "$1" = "--start-daemon") || (test "$1" = "-d") then if (test "$pid" > "0") then echo pid "$pid" - already started else echo starting as daemon $python $instabot $login $pass $config > "/private/var/Log/instabot/$(date +%dd-(%H)).log" & exit fi fi

if (test "$1" = "--start") || (test "$1" = "-s") then if (test "$pid" > "0") then echo pid "$pid" - already started else echo starting in terminal $python $instabot $login $pass $config > "/private/var/Log/instabot/$(date +%dd-(%H)).log" exit fi fi

if (test "$1" = "--restart") || (test "$1" = "-r") then if (test "$pid" > "0") then $kill $pid echo restarting $python $instabot $login $pass $config > "/private/var/Log/instabot/$(date +%dd-(%H)).log" & exit else echo instabot - no running process. exit fi fi

if (test "$1" = "--help") || (test "$1" = "-h") then echo "help:" echo " -s, --start Start instabot" echo " -d, --start-daemon Start instabot standalone" echo " -n, --newstart Re-login and start" echo " -k, --kill Kill instabot" echo " -r, --restart Restart instabot" echo " -c, --check Check instabot" echo " -h, --help Help" exit fi

if (test "$1" = "--check") || (test "$1" = "-c") then if (test "$pid" > "0") then echo "Instabot is running" echo "pid:" "$pid" exit else echo "Instabot is not running" fi fi

if (test "$1" = "--newstart") || (test "$1" = "-n") then if (test "$pid" > "0") then $kill $pid rm $session echo Session file removed echo starting $python $instabot $login $pass $config > "/private/var/Log/instabot/$(date +%dd-(%H)).log" & exit else rm $session echo Session file removed echo starting $python $instabot $login $pass $config > "/private/var/Log/instabot/$(date +%dd-(%H)).log" & exit fi else echo "Argument required!" echo "help:" echo " -s, --start Start instabot" echo " -d, --start-daemon Start instabot standalone" echo " -n, --newstart Re-login and start" echo " -k, --kill Kill instabot" echo " -r, --restart Restart instabot" echo " -c, --check Check instabot" echo " -h, --help Help" exit fi

yurilaaziz commented 4 years ago

Thank you, you can start this bot using the command-line program neo-instabot -c yourconfiguration.yml