git pull Could not resolve host: github.com *only* on jail boot in rc.d script

dpozinen

Cadet
Joined
May 19, 2022
Messages
1
So I've looked through all the similar issues, but they seem to all be related to some vpn/router/network setup, mine is different in that I can
access github without issues everywhere any time, except during jail boot.

In terms of my ultimate goal:
I have an app running in my jail, so on jail restart i want to pull changes and then start the app. The latter works fine, only git is having issues for some reason.


Code:
#!/bin/sh

. /etc/rc.subr

export JAVA_HOME=/usr/local/openjdk11

name=trackeropsd
rcvar=trackeropsd_enable
command="/root/start-tracker-ops.sh"

load_rc_config $name
run_rc_command "$1"


and the actual startup script:
Code:
#!/bin/sh

cd /root/tracker-ops

/usr/local/bin/git pull origin master >> /root/git-log.log 2>&1

# ./gradlew run &


So nothing fancy. I had to use /usr/local/bin/git instead of just git because it said command not found.

here's the git-log.log:

when run on jail restart:
Code:
fatal: unable to access 'https://github.com/dpozinen/tracker-ops.git/': Could not resolve host: github.com


when I run git pull or the actual start-tracker-ops.sh script or service trackeropsd start:
Code:
From https://github.com/dpozinen/tracker-ops
 * branch            master     -> FETCH_HEAD
Already up to date.


exec_system_user and exec_jail_user are both root

Any help would be appreciated
 

jro

iXsystems
iXsystems
Joined
Jul 16, 2018
Messages
80
Just a guess, but it could be that the script is firing before DNS is running... I'm guessing `host github.com` works as expected on the jail?

You could try adding a `/bin/sleep 20` early on in the script.
 
Top