Hello, I want to share in a very easy way, files on my local network by using http. I have installed miniserve, but I can not find any documentation of how to use it.
You can create an rc.d script which daemonizes any executable. This would allow for the service to be auto-started as well as being automatically being restarted if it crashes.
I left a few notes regarding that in my blog a while ago: https://blog.insane.engineer/post/freebsd_daemonize
#!/bin/sh
# PROVIDE: miniserver
# REQUIRE: networking
# KEYWORD:
. /etc/rc.subr
name="miniserve"
rcvar="miniserve_enable"
miniserve_user="miniserve"
miniserve_command="/usr/local/bin/miniserve"
pidfile="/var/run/miniserve/${name}.pid"
command="/usr/sbin/miniserve"
command_args="-P ${pidfile} -r -f ${miniserve_command}"
load_rc_config $name
: ${miniserve_enable:=no}
run_rc_command "$1"
Sure, that might work too.Also, could it be set in crontab? As for example:
Thanks but I do not know if I wrote the script ok or notSure, that might work too.
Usually, rc.d would be the preferred option here as the OS then "knows" about the service. You can ask it to start it, to stop it, you can query the status, PID and so on.
Furthermore, you get control over when the service is being started. For example, you can ensure that your miniserve service is not started before networking is up & running etc.
I'm no rc.d expert. I'd argue, if this is your first rodeo, the question would be: does it do what you want?Thanks but I do not know if I wrote the script ok or not
I haven't really looked at miniserve but as far as I can tell it's a simple HTTP server. Therefore, any file being served is just that: A file being served over an HTTP response.And I have another question, can I set for example the .exe files to direct execute from the server instead of download it? Because if I click on it right now it download the file only.