First you need to make sure each line/part of your bash script work in a shell (outside of a script). I cannot tell if yours will so you'll have to check that yourself.
And to execute a python script you need python
BEFORE the path to the script
Also:
~
is a shortcut to the home directory of the current user
~asdf
is a shortcut to the home directory for the asdf user
~/Documents
is the path to the Documents
folder in the home directory of the current user
~Documents
is looking for the home directory of the Directory user which is invalid unless you have a user called Directory
As @muru pointed out, you probably meant ~/Documents. So your bash script would probably look something like this
#!/bin/bash
python ~/Documents/dota2/dotaapi2/match_scraper.py
psql dota2apidb
update games set online=1 where online is null;
python ~/Documents/dota2/gosugamers/gosugamers/spiders/scrapy crawl dota
Again, I do not know if this will work since I have no clue if each line will work. For example, does python ~/Documents/dota2/gosugamers/gosugamers/spiders/scrapy crawl dota
actually work when you run it on the command line?
And I do not know psql but I suspect you need to pass it some command line paramater to get it to run that update...
command?
~Documents/dota2/dotaapi2/
and~Documents/dota2/gosugamers/gosugamers/spiders/
supposed to be? The directories containing the scripts? I'd guess you want to docd ~/Documents/dota2/gosugamers/gosugamers/spiders/
(and similarly for the other one), instead. (Note: slash/
after~
: askubuntu.com/q/656869/158442)