Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Daemonizing H@H on BSD

 
post Mar 18 2018, 00:45
Post #1
myaccount



Newcomer
*
Group: Members
Posts: 13
Joined: 14-June 11
Level 415 (Dovahkiin)


I noticed there is no guide on how to use H@H on BSD systems so I thought I would make quick guide on getting it running as a service.

Platform: FreeBSD 11.1 (in a Jail. Make sure you allow raw sockets!)
Packages: ca_root_nss, openjdk8
Other files: Newest package from https://e-hentai.org/hentaiathome.php

1)unpack the zip to wherever you want (e.g. /usr/bin/local/share/hath). I used /config which was mounted via fstab.
2)make a user to run the program. Do NOT run it as root even if its in a jail and you also don't need to have a user with a home or login shell. I used the following:
hath:*:6969:6969::0:0:hath:/nonexistent:/usr/bin/nologin
3)run the program once to get it setup: java -Djava.net.preferIPv4Stack=true -jar /path/to/h@h/h@h.jar
4)once it is setup you can CTRL+C
5)make an rc.d script (e.g., /usr/local/etc/rc.d/hath)
6)use this but make sure to change things based on where you put and named H@H:
CODE
#!/bin/sh

# $FreeBSD$
#
# PROVIDE: hath
# REQUIRE: LOGIN SERVERS DAEMON resolv
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# hath_enable:    Set to YES to enable hath
#            Default: NO
# hath_user:    The user account used to run the hath daemon.
#            This is optional, however do not specifically set this to an
#            empty string as this will cause the daemon to run as root.
#            Default: hath
# hath_group:    The group account used to run the hath daemon.
#            This is optional, however do not specifically set this to an
#            empty string as this will cause the daemon to run with group wheel.
#            Default: hath
# hath_data_dir:    Directory where hath configuration
#            data is stored.
#            Default: /config

. /etc/rc.subr
name="hath"
rcvar=${name}_enable
hath_chdir="/config"
load_rc_config $name

: ${hath_enable:="NO"}
: ${hath_user:="hath"}
: ${hath_group:="hath"}
: ${hath_data_dir:="/config"}

pidfile_child="${hath_data_dir}/${name}.pid"
pidfile="${hath_data_dir}/${name}_daemon.pid"

command="/usr/sbin/daemon"
start_precmd="${name}_prestart"
#procname="java" #not all ports correctly parse this in daemon form so I have removed it


hath_prestart() {

        rc_flags="-r -P ${pidfile} -p ${pidfile_child} /usr/local/bin/java -Djava.net.preferIPv4Stack=true -jar /config/hath.jar >> /dev/null 2>&1 ${rc_flags}"

}

run_rc_command "$1"


7)don't forget to fix permissions of files in H@H path (owner:group should be H@H user) and the new script (u+x should be fine). Also make sure rc.conf contains ATLEAST hath_enable="YES"
8)start the service: service hath start
9)enjoy!

EDIT: updated packages for 1.6.0 and 1.6.1 openjdk8 is REQUIRED

This post has been edited by myaccount: Sep 5 2020, 06:31
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Jan 5 2020, 10:51
Post #2
myaccount



Newcomer
*
Group: Members
Posts: 13
Joined: 14-June 11
Level 415 (Dovahkiin)


ONE update to this for HATH 1.6.0 Stable:
openjdk8 is now required as openjdk7 will not work!
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Jan 5 2020, 16:17
Post #3
blue penguin



in umbra, igitur, pugnabimus
***********
Group: Gold Star Club
Posts: 10,045
Joined: 24-March 12
Level 500 (Godslayer)


Forgot to pin this one. now it is up.

It is pretty good, notably the pid file lock.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Sep 5 2020, 06:30
Post #4
myaccount



Newcomer
*
Group: Members
Posts: 13
Joined: 14-June 11
Level 415 (Dovahkiin)


No updates needed for 1.6.1 other than me being too lazy to rewrite this to add support for "status" which is also not supported by all ports.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Oct 2 2022, 01:09
Post #5
cb000



Casual Poster
***
Group: Members
Posts: 140
Joined: 19-March 11
Level 394 (Dovahkiin)


https://forums.e-hentai.org/index.php?act=S...=0#entry6188552

After I wrote my own one, I finally find that there is a successor working in FreeBSD.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 


Lo-Fi Version Time is now: 29th April 2024 - 13:04