gitUpdate.sh

I am using the script to push my config to GitHub

#!/bin/bash

cd /home/homeassistant/.homeassistant
source /srv/homeassistant/bin/activate
hass --script check_config

git add .
git status
echo -n "Enter the Description for the Change: " [Minor Update]
read CHANGE_MSG
git commit -m "${CHANGE_MSG}"
git push origin master

exit

I would like to add the command to enter the virtual environment and then continue with the scrips, how do I do that? I am struggling to continue wit the script as a homassistant user.

sudo su -s /bin/bash homeassistant

Off the top of my head I can’t remember, it is possible, but I just wanted to pop in and ask why you want to? The files are still the files and will be pushed to GitHub all the same.

I thougt I needed to first activate the home assistant user and the runt the script, can I run it as user pi?

I would like to put a alias in .bashrc to run the script so I easy just can type gitupdate to start the process

Just tried that, its not possible

Where is your script?

I run mine (almost identical to yours) from pi. In my case I run:

sudo /home/hass/.homeassistant/extras/bash_scripts/send-to-github.sh

My script is on my GitHub…

Link removed

I modified my script and removed hass --script check_config and then it worked to run as pi without any errors, thanks for the help @anon43302295

1 Like