How to run a custom PHP code for Magento 2 from the command line?

Hi,

I have a products import script, its running successfully but i want to run it from bash and also want to run the indexer from cron, any solution ?

Can we run indexer from cron ?

Did you read the first link above?!