Instapy: Automate InstaPy with Crontab

Created on 9 Aug 2017  路  9Comments  路  Source: timgrossmann/InstaPy

Hi everybody, can someone tell me why my script does not run from server? So I installed everything correctly and set the crontab to run quickstart.py every 3 hours. If I check with "grep "quickstart.py" /var/log/syslog" it says the file is run every 3 hours... but I cannot see that I really followed anybody new or liked images. Can you help me?

When I start quickstart.py from mac terminal it runs through and works fine. But with crontab it seems like nothing happens..... :/ Do I have to adjust it on the server?

help wanted question

All 9 comments

@flothousand Did you add the nogui=True parameter in the InstaPy(username="", password="") constructor?

Make sure to read the part on how to run it on the server from the README

Commands executed with cron do not have the same env variables you normally have. Check which ones are available by running a printenv in a cron job

@timgrossmann first of all thanks for your support and the great code :) fun to play with!

So I added now the nogui parameter to the quickstart behind username and password. Will check in the next hours if I am following more people and let you know

Okay still not running. I installed all the packages on he server and also running quickstart from mac works fine. I am just wondering which information you need so that you could help me.

Do I have to change anything else than adding nogui=true in quickstart.py file?

@flothousand Try to run the quickstart file by hand first.

Do python3.5 quickstart.py or whatever your file is called.
If that works, it's your crontab.

Make sure to put your environment vars, if you set them there, in the /etc/environment file.
Make sure your crontab looks something like this: 0 */4 * * * cd /InstaPy && python3.5 quickstart.py.
The crontab job has to move to the InstaPy folder first

okay just checked, quickstart on mac running, got python 3.5
Changed crontab from 0 */3 * * * /home/ubuntu/InstaPy && /usr/bin/python ./quickstart.py
to 0 */3 * * * /home/ubuntu/InstaPy && /usr/bin/python3.5 quickstart.py

Will keep you updated :)

@flothousand Make sure to add the cd before the directory path /home/ubuntu/InstaPy 馃槈

Yeeees, now it works @timgrossmann
It was not a fault with my crontab, but had to reinstall pyvirtualdisplay :) Cool!

@flothousand Awesome, thanks for sharing the solution!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Spyd3r0us picture Spyd3r0us  路  3Comments

harrypython picture harrypython  路  3Comments

v77v picture v77v  路  3Comments

rahulkapoor90 picture rahulkapoor90  路  3Comments

wyvers picture wyvers  路  3Comments