Run shell command at pfsense reboot



  • Hello guys, i've set up a server at my office to run pfsense 2.1.5, installed completed with no problems, up and running.

    Next i added some packages (unzip, wget, mongodb, openjdk7), installed Unifi Controlled for Unix for my Unifi AP's

    The Unifi Controller interface can start only by going to Shell Command and executing the following: /usr/local/openjdk7/bin/java -jar /usr/local/UniFi/lib/ace.jar start & thow the wireless AP's are working with no problem.

    I want to add the line /usr/local/openjdk7/bin/java -jar /usr/local/UniFi/lib/ace.jar start & at pfSense boot, every time system restarts it must load the Unifi Controller Interface.

    I tried adding at /usr/local/etc/rc.d a start_unifi.sh with code:

    /usr/local/openjdk7/bin/java -jar /usr/local/UniFi/lib/ace.jar start &
    

    After system reboot at the end it says: start_unifi.sh is loaded ok … done but my Unifi Controller Interface doesn't start. If i go to Shell Command and enter /usr/local/openjdk7/bin/java -jar /usr/local/UniFi/lib/ace.jar start & after a couple of minutes Controller is up

    What can i do, or what have i done wrong? I need to start the service on system boot.


  • Rebel Alliance

    Have you tried with the "shellcmd option" option ?

    https://doc.pfsense.org/index.php/Executing_commands_at_boot_time


  • Banned

    @mariusblk:

    what have i done wrong?

    You installed Java on your firewall…  :'( :(



  • @doktornotor:

    @mariusblk:

    what have i done wrong?

    You installed Java on your firewall…  :'( :(

    LOL

    I was going to do that at one point but decided to have it run on my windows server that is up 24/7 instead



  • @ptt:

    Have you tried with the "shellcmd option" option ?

    https://doc.pfsense.org/index.php/Executing_commands_at_boot_time

    I'm not sure if i insert the <shellcmd>in the right spot … i'll try to run it</shellcmd>



  • @Cino:

    @doktornotor:

    @mariusblk:

    what have i done wrong?

    You installed Java on your firewall…  :'( :(

    LOL

    I was going to do that at one point but decided to have it run on my windows server that is up 24/7 instead

    And why is it such a bad idea, point me to something.


  • Banned

    @mariusblk:

    I'm not sure if i insert the <shellcmd>in the right spot … i'll try to run it</shellcmd>

    There's this Shellcmd package to solve that for you via GUI. :D

    @mariusblk:

    And why is it such a bad idea, point me to something.



  • Java on my server has been flawless.

    Java on my personal computer nags me more than a clingy GF.



  • There is a shellcmd package that you can install which will insert them into the config.xml correctly.

    Its just not good practice to run anything on a fw. But it's your fw, so you can install anything you want.. but if it conflicts with the pfsense core system, you may be able to get support from pfsense or the forum.

    Java itself is always being updated due to security issues… I won't recommend it but play it safe... stay update with updates, and make sure its not binding to your WAN or any interface you dont want it on



  • I installed the package with shellcommand added the line but doesn't work, on pfSense startup

    "Starting NTP time client …. done
    Starting DHCP Service .... done
    "
    and freezes. I can access webConfigurator with no problem, links are up, internet is working, java process is starting and Unifi Controller is up and running.

    I can access server using putty and there is no problem, any hints why the visuals on pfsense server halt at that point?



  • Am having the same problem with Java/Shellcmd. The booting gets stuck at "Configuring Firewall"

    Any Ideas?

    Thanks

    Alfredo.



  • I wouldn't recommend running that software on your firewall.  I run UniFi on a Raspberry Pi at home.



  • Thanks; we're not running Unify; we're using java for a very secure internal program. pfSense can't finish booting