Hi all--
I've been attempting to get a java app running at startup in a jail with no luck. Basically i've created a script that can run the app, but it only works when run from within the folder containing the app-- if I call it from / or anywhere else it doesn't work. Even if I change the location of the app in the script to /path/to/java.jar it still seems to expect to be inside the folder in order to be able to find everything and run properly.
My hacked together solution to fix this was to "cd" as the first step of the script-- basically this is what I want it to do:
1. cd /folder/containing/app/
2. tmux new sessession
3. run java app
4. detach session
this is the commad I have right now:
this works, when called from anywhere, from within a script file. But it doesn't seem to work when placed in /usr/local/etc/rc.d or as a command issued in cron.
I realize this is probably an extremely inelegant way of doing this, but I couldn't wrap my head around what I was reading here: https://www.freebsd.org/doc/en/articles/rc-scripting/ in order to get something so seemingly simple to start...
The next thing I tried was to install pm2 to manage the app instead of relying on starting it manually and using tmux, but pm2 throws up syntax errors on trying to run to run it per the instructions of the app creators (who are running on linux)
if anyone can help me make an actual script for this, or point me in the direction of an alternative management tool i'd be much obliged-- thanks everyone
I've been attempting to get a java app running at startup in a jail with no luck. Basically i've created a script that can run the app, but it only works when run from within the folder containing the app-- if I call it from / or anywhere else it doesn't work. Even if I change the location of the app in the script to /path/to/java.jar it still seems to expect to be inside the folder in order to be able to find everything and run properly.
My hacked together solution to fix this was to "cd" as the first step of the script-- basically this is what I want it to do:
1. cd /folder/containing/app/
2. tmux new sessession
3. run java app
4. detach session
this is the commad I have right now:
cd /App_location && tmux new-session -s app_Start java -Djava.net.preferIPv4Stack=true -Dsun.stdout.encoding=UTF-8 -jar JavaApp.jar -XX:+UseConcMarkSweepGC -Xmx512m -Xms512m
this works, when called from anywhere, from within a script file. But it doesn't seem to work when placed in /usr/local/etc/rc.d or as a command issued in cron.
I realize this is probably an extremely inelegant way of doing this, but I couldn't wrap my head around what I was reading here: https://www.freebsd.org/doc/en/articles/rc-scripting/ in order to get something so seemingly simple to start...
The next thing I tried was to install pm2 to manage the app instead of relying on starting it manually and using tmux, but pm2 throws up syntax errors on trying to run to run it per the instructions of the app creators (who are running on linux)
if anyone can help me make an actual script for this, or point me in the direction of an alternative management tool i'd be much obliged-- thanks everyone