简体   繁体   中英

Will crontab run scripts on git branch master or main by default?

Excuse me if this post should be on a forum other than stack overflow.

On a linux cluster I am running a python script 24/7 to connect to a data stream, process it, and push it to a database. A crontab file is setup to monitor that the script is running and if it stops it will be started again.

I need to edit the script and test it, so created a git branch for that. I want to make sure that if the original script (on branch main) stops, the crontab will run it and not the modified file on the new branch.

My two questions are:

  1. Does crontab run scripts on main (or master) by default?
  2. How can I specify the git branch of file I want to run when calling it? (Mostly for verbosity)

Crontab will run on a file, so, whatever state the local repo is in, whether it's updated with main/master or pulled to another branch, or edited locally, it will run that file.

If you want to explicitly run a particular branch, my advice is to point cron at a separate file, which could take the branch as a parameter, that will then prepare the script location however you want, and subsequently run it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM