Problem getting initialization command to work

Status
Not open for further replies.

Steally

Cadet
Joined
Apr 18, 2015
Messages
6
Good morning everyone,
I am having a problem trying to get my vpn to auto start. I went to the freenas tasks init/shutdown scripts and added a command postinit of openvpn /root/foo.ovpn. That is the correct location of my ovpn file and the command works in shell but I have to manually start it every time I restart my freenas box. What am I doing wrong?

Thanks in advance guys!
 
D

dlavigne

Guest
Which build of FreeNAS (from System -> Information)? Did you give the full path to the openvpn executable? Any related error messages in /var/log/messages?
 

Steally

Cadet
Joined
Apr 18, 2015
Messages
6
Sorry. I am on FreeNAS-9.3-STABLE-201509022158. /root/foo.ovpn is the full path to the executable. also the only thing I was able to find in the log was

Sep 17 13:27:24 sabnzbd_1 root: /etc/rc: WARNING: /usr/local/etc/openvpn/openvpn.conf is not readable.
Sep 17 13:27:24 sabnzbd_1 root: /etc/rc: WARNING: failed precmd routine for openvpn

I know I can manually run the program through putty or the shell using the command openvpn /root/foo.ovpn. Why would asking it to run the same command on startup be different?

Again thanks in advance for the help.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Sorry. I am on FreeNAS-9.3-STABLE-201509022158. /root/foo.ovpn is the full path to the executable. also the only thing I was able to find in the log was

Sep 17 13:27:24 sabnzbd_1 root: /etc/rc: WARNING: /usr/local/etc/openvpn/openvpn.conf is not readable.
Sep 17 13:27:24 sabnzbd_1 root: /etc/rc: WARNING: failed precmd routine for openvpn

I know I can manually run the program through putty or the shell using the command openvpn /root/foo.ovpn. Why would asking it to run the same command on startup be different?

Again thanks in advance for the help.
when you run the command manually is it in the jail? the freenas init commands run on the host
 

Steally

Cadet
Joined
Apr 18, 2015
Messages
6
The only message I could find anything on vpn was the sabnzbd jail but the command is run from the root directory for the freenas system. Would moving it to another directory help?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
The only message I could find anything on vpn was the sabnzbd jail but the command is run from the root directory for the freenas system. Would moving it to another directory help?
ahh, OK. maybe it has to do with the command being run from a different shell, or with a path that doesn't include all the needed locations.
 

Steally

Cadet
Joined
Apr 18, 2015
Messages
6
Doing a search for the file returns the path as /root/foo.ovpn. is there a default folder it needs to be in? I figured if I gave it the full path it shouldn't matter.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Doing a search for the file returns the path as /root/foo.ovpn. is there a default folder it needs to be in? I figured if I gave it the full path it shouldn't matter.
I don't think you understand what I meant.

I'm talking about the shell $PATH variable which tells whatever shell is being run where to look for executables for relative paths being executed.

if foo.opvn is a script or calls a script you might need to edit them to call absolute paths instead.
 

Steally

Cadet
Joined
Apr 18, 2015
Messages
6
I think I get it but I'm past my knowledge point now. Is there a default $path that is used and if so how do I move my foo.ovpn file to it?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I think I get it but I'm past my knowledge point now. Is there a default $path that is used and if so how do I move my foo.ovpn file to it?
it doesn't matter where that file is since you are calling it directly, only if that needs to call other commands.

I'm not sure what it is, but if you really need to know you could setup a startup command that runs the below
cat $PATH > /root/path.log
 

Steally

Cadet
Joined
Apr 18, 2015
Messages
6
The file I downloaded from air vpn to have the certificates and keys to log in. I do not see any other commands in the file. I could be wrong though as it's a big jumble.
 
Status
Not open for further replies.
Top