Noobie here with a noobie question

So this is I am sure an easy question. I have a file that I want to put up on Git so I can download it as needed. Occasionally I will make changes to it. The downloading device will be a Linux machine and I will be using a python script to get the file. I will be running th ecommand from within the file that I will be downloading into the same directory, so How will I be able to update the running file?

Thanks in advance for any help

1 Like

Hello, welcome to our little community! Would you mind clarifying a bit, what you are asking seems unclear to me.

The downloading device will be a Linux machine and I will be using a python script to get the file.

If I understand correctly, you just want to occasionally make changes to the file, download the file and run it?

I do this too sometimes, you can just use Git:

Clone the repo:

git clone https://github.com/cqsimple/tech

Change into the directory:

cd tech

Run the file:

python3 Tech.py

If you have to delete it, use this command:

cd && rm -rf remove Tech

And then repeat.

HI Thanks for the answer.

I have written a small python script that we are going to put on our phone systems (Freepbx based running Centos) We are going to allow a user to SSH into it with a user that has limited rights. The python script will run as soon as they login. I have given them a way to exit the script and want to use a bash script or even a python script to run to “update” the original python file. I figured GIT would be good for this.

1 Like

Yeah, Git would be great. I don’t use Git on mobile much, but when I do, I use Termux. Maybe that would help?

No usage on a mobile tho. only on a PC

Using this:
git clone https://github.com/cqsimple/tech

I get command not found. Do I need to install git?

Yep installing git did the trick

Thanks!

Glad I could help. Let me know if you knead anything else.

i will Thanks again!

Is it possible to overwrite the existing files when doing the cloning? Having to remove the directory every time is a PIA

Is it possible to overwrite the existing files when doing the cloning?

No. You can push the new changes using this command:

git add . && git commit -m "Commit Message" && git push origin

As a side tip, next time you should mention me (@Mr-Steal-Your-Script) or reply to a comment if you want me to see it. The only reason I saw this one was because I clicked on the wrong link in my browser history :slight_smile:

I also recommend checking out this section of the support community for more Git related questions. Be sure to read this post

You shouldn’t need to do a fresh clone every time, pulling will be enough unless you rewrite history in the repository on Github.

I am grateful for your mistake :)) I have alot to lear about Git Thanks

I don’t expect alot of changes, just want to be able to update these boxes easily. The user will have to interact with the system and I want it to be as fool proof as I can get it.

In that case: Why use git on the boxes at all? You can just download the script from Github using its raw URL, e.g. https://raw.githubusercontent.com/cqsimple/tech/main/Tech.py

What am I missing airtower-luna ? Using the link: https://raw.githubusercontent.com/cqsimple/tech/main/Tech.py
I get a file not found and using
curl https://raw.githubusercontent.com/cqsimple/tech/main/Tech.py
I get the file contents to the screen

Looking at the repository you seem to have renamed the Tech.py file to Tools.py about the same time you made this post. You’ll have to update the URL accordingly, that it worked in one case might have been a caching thing or something.

What are in variables

Yeah I am still wrapping my head around all that I have to do to get this off the ground and renaming a file or two seemed to indicate better what it does. I am reading up on using pull to update the files on the boxes.

curl https://raw.githubusercontent.com/cqsimple/tech/main/Tools.py

Once you change the file name, the url will have to be updated.