Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5 another question about booting #6

Merged
merged 11 commits into from
Mar 2, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
moved some stuff around... really working now
SamEureka committed Mar 1, 2023
commit 7beb2f3f79aa23c9eb7059c471dd68c0df6b8c2a
15 changes: 15 additions & 0 deletions balenaPhono/booter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

# Need to copy the env to a .env file so the booter.py script can access
# the environment variables. I could not figure out a better way to do this.
env >> /balenaPhono/.env
echo "Variables copied to .env"

# Let's update the crond to reboot the system every 24 hours
# at the time specified in the REBOOT_TIME env variable.
# (defaults to 4am in the timezone specified in the TZ variable.)
REBOOT_TIME="${REBOOT_TIME:=4}"
INCREMENT="${INCREMENT:=0}"
(echo "${INCREMENT} ${REBOOT_TIME} * * * /usr/local/bin/python /balenaPhono/booter.py > /proc/1/fd/1 2>&1") | crontab -
exec cron -f
echo "cron updated"
15 changes: 2 additions & 13 deletions balenaPhono/start.sh
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
## balenaPhono/start.sh ##
## Sam Dennon//2023 ##

chmod +x /balenaPhono/booter.sh

# Build the config files
python3 phonoConfig.py
@@ -26,16 +27,4 @@ done
echo "USB device detected, starting Darkice stream"
darkice -c ./darkice.cfg

# Need to copy the env to a .env file so the booter.py script can access
# the environment variables. I could not figure out a better way to do this.
env >> /balenaPhono/.env
echo "Variables copied to .env"

# Let's update the crond to reboot the system every 24 hours
# at the time specified in the REBOOT_TIME env variable.
# (defaults to 4am in the timezone specified in the TZ variable.)
REBOOT_TIME="${REBOOT_TIME:=4}"
INCREMENT="${INCREMENT:=0}"
(echo "${INCREMENT} ${REBOOT_TIME} * * * /usr/local/bin/python /balenaPhono/booter.py > /proc/1/fd/1 2>&1") | crontab -
exec cron -f
echo "cron updated"
source /balenaPhono/booter.sh