Created
August 20, 2018 11:46
-
-
Save crooksey/f9fb577269d5af5a9698dce1fccb7124 to your computer and use it in GitHub Desktop.
Traccar rc.d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# PROVIDE: traccar | |
# REQUIRE: DAEMON | |
# BEFORE: | |
# KEYWORD: shutdown | |
# Add the following lines to /etc/rc.conf to enable `traccar': | |
# | |
# traccar_enable="YES" | |
# | |
. /etc/rc.subr | |
name="traccar" | |
rcvar="traccar_enable" | |
# read configuration and set defaults | |
load_rc_config "${name}" | |
: ${traccar_enable="NO"} | |
: ${traccar_root="/usr/local/traccar"} # standard root | |
: ${traccar_args="-jar ${traccar_root}/tracker-server.jar ${traccar_root}/conf/traccar.xml"} | |
: ${traccar_java="/usr/local/openjdk7-jre/bin/java"} # path to your JRE | |
: ${traccar_user="root"} # user to run as | |
: ${traccar_stdout="/var/log/traccar_running.log"} | |
: ${traccar_stderr="/var/log/traccar_error.log"} | |
traccar_chdir=${traccar_root} # will add a cd $traccar_root before launching | |
command="$traccar_java" | |
command_args="-jar ${traccar_root}/tracker-server.jar ${traccar_root}/conf/traccar.xml" | |
pidfile="/var/run/${name}.pid" | |
required_files="${traccar_root}/conf/traccar.xml" | |
# ugly hack to abuse this but I don't want to launch with nohup around su | |
start_cmd="/usr/sbin/daemon -p ${pidfile} -u ${traccar_user} ${command} ${command_args} > ${traccar_stdout} 2> ${traccar_stderr}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment