Following the instructions on the wiki (
https://ehwiki.org/wiki/Installing_H@H_on_Ubuntu ) I reached the part about running H@H on the background. It recommends to use
nohup, which I considered a poor choice if you want to access the logs or want an easy way to stop and restart it, so I used PM2 that lets me save the logs to a file, easily check the last logged lines, auto-rotate a log file at X size, make it start on startup, manage how much memory is it taking, auto-restart when the process crashes...
PM2 is made with managing JS apps in mind, but it can be used with Python, Java,... I use it in my workplace everyday. It requires
npm which is bundled with
nodejs. I don't recommend using the version from
apt unless you're very short on disk space and don't want install all the dependencies because it's kind of outdated. Download can be found here: ( [
nodejs.org]
https://nodejs.org/en/ ).
Run
npm install pm2 -g to install it. The
-g flag is important because it will install in globally instead of on the local folder. You might need superuser power to do the task.
Once you have
npm and
nodejs, imagine you have the following setup:
CODE
/home/username/hath/HentaiAtHome.jar
therefore, the files are stored in
/home/username/hath/. Now you only need to place a JSON anywhere (I place it inside the
hath folder) with the following:
CODE
{
"apps": [{
"name": "H@H",
"cwd": "/home/username/hath/",
"args": [
"-jar",
"/home/username/hath/HentaiAtHome.jar"
],
"script": "java",
"node_args": [],
"log_date_format": "YYYY-MM-DD HH:mm Z",
"exec_interpreter": "none",
"exec_mode": "fork"
}
]
}
name: name that will show on PM2
cwd: folder where the app will run
script: program to launch
args: self-explanatory
We can name it whatever we want, I use
hath_pm2.json. Now just add it to PM2 with:
CODE
pm2 start hath_pm2.json
It will add it to the process list, you can check it with:
CODE
pm2 list
To finish, some useful commands:
Make PM2 launch at startup (follow the instructions on the terminal)
CODE
pm2 startup
Save the current process list, so next launch will be added (this is important to do at least once)
CODE
pm2 save
Check all the commands (because I wont post them all here)
CODE
pm2 help
I recommend using PM2 as it's a very useful and powerful utility. So, that was it, thank you for reading!
[
i.imgur.com]
https://i.imgur.com/q8Q0QKh.pngThis post has been edited by KuronekoIsMyWaifu_: Feb 12 2018, 01:27