mirror of
https://github.com/3proxy/3proxy.git
synced 2026-04-06 21:30:12 +08:00
add rc.d script
Some checks are pending
C/C++ CI / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI / ${{ matrix.target }} (windows-2022) (push) Waiting to run
Some checks are pending
C/C++ CI / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI / ${{ matrix.target }} (windows-2022) (push) Waiting to run
This commit is contained in:
parent
d502ecb0fd
commit
28969bbc5a
@ -509,9 +509,26 @@ if(NOT WIN32)
|
||||
install(FILES scripts/add3proxyuser.sh DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
|
||||
# Install service files (systemd or init.d)
|
||||
# Install service files (systemd, init.d, or rc.d)
|
||||
if(NOT WIN32)
|
||||
# Check for systemd
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD|Darwin|OpenBSD|NetBSD")
|
||||
# BSD/macOS - install rc.d script
|
||||
set(RCD_DIR "/usr/local/etc/rc.d")
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scripts/rc.d/3proxy.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/3proxy.rc
|
||||
@ONLY
|
||||
)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/3proxy.rc
|
||||
DESTINATION ${RCD_DIR}
|
||||
RENAME 3proxy
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
|
||||
)
|
||||
|
||||
message(STATUS " rc.d: YES (${RCD_DIR})")
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# Linux - check for systemd
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(SYSTEMD QUIET systemd)
|
||||
@ -557,6 +574,16 @@ if(NOT WIN32)
|
||||
|
||||
message(STATUS " systemd: NO (using init.d)")
|
||||
endif()
|
||||
else()
|
||||
# Other Unix - install init.d script
|
||||
install(FILES scripts/init.d/3proxy.sh
|
||||
DESTINATION /etc/init.d
|
||||
RENAME 3proxy
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
|
||||
)
|
||||
|
||||
message(STATUS " init.d: YES (/etc/init.d)")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Install man pages
|
||||
|
||||
@ -50,7 +50,7 @@ install: all
|
||||
if [ ! -d "/usr/local/3proxy/bin" ]; then mkdir -p /usr/local/3proxy/bin/; fi
|
||||
install bin/3proxy /usr/local/3proxy/bin/3proxy
|
||||
install bin/mycrypt /usr/local/3proxy/bin/mycrypt
|
||||
install scripts/init.d/proxy.sh /usr/local/etc/rc.d/3proxy
|
||||
install scripts/rc.d/3proxy /usr/local/etc/rc.d/3proxy
|
||||
install scripts/add3proxyuser.sh /usr/local/3proxy/bin/
|
||||
if [ -s /usr/local/etc/3proxy/3proxy.cfg ]; then /usr/local/3proxy/3proxy.cfg already exists ; else install scripts/3proxy.cfg /usr/local/etc/3proxy/; fi
|
||||
if [ ! -d /var/log/3proxy/ ]; then mkdir /var/log/3proxy/; fi
|
||||
|
||||
@ -51,7 +51,7 @@ install: all
|
||||
if [ ! -d "/usr/local/3proxy/bin" ]; then mkdir -p /usr/local/3proxy/bin/; fi
|
||||
install bin/3proxy /usr/local/3proxy/bin/3proxy
|
||||
install bin/mycrypt /usr/local/3proxy/bin/mycrypt
|
||||
install scripts/init.d/proxy.sh /usr/local/etc/rc.d/3proxy
|
||||
install scripts/rc.d/3proxy /usr/local/etc/rc.d/3proxy
|
||||
install scripts/add3proxyuser.sh /usr/local/3proxy/bin/
|
||||
if [ -s /usr/local/etc/3proxy/3proxy.cfg ]; then /usr/local/3proxy/3proxy.cfg already exists ; else install scripts/3proxy.cfg /usr/local/etc/3proxy/; fi
|
||||
if [ ! -d /var/log/3proxy/ ]; then mkdir /var/log/3proxy/; fi
|
||||
|
||||
27
scripts/rc.d/3proxy
Normal file
27
scripts/rc.d/3proxy
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
# PROVIDE: 3proxy
|
||||
# REQUIRE: LOGIN DAEMON
|
||||
# KEYWORD: shutdown
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="3proxy"
|
||||
rcvar="3proxy_enable"
|
||||
|
||||
command="/usr/local/3proxy/bin/3proxy"
|
||||
pidfile="/var/run/3proxy/${name}.pid"
|
||||
command_args="${3proxy_config:-/usr/local/etc/3proxy/3proxy.cfg}"
|
||||
required_files="${3proxy_config:-/usr/local/etc/3proxy/3proxy.cfg}"
|
||||
|
||||
start_precmd="3proxy_precmd"
|
||||
|
||||
3proxy_precmd()
|
||||
{
|
||||
if [ ! -d /var/run/3proxy ]; then
|
||||
mkdir -p /var/run/3proxy
|
||||
fi
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
||||
27
scripts/rc.d/3proxy.in
Normal file
27
scripts/rc.d/3proxy.in
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
# PROVIDE: 3proxy
|
||||
# REQUIRE: LOGIN DAEMON
|
||||
# KEYWORD: shutdown
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="3proxy"
|
||||
rcvar="3proxy_enable"
|
||||
|
||||
command="@CMAKE_INSTALL_FULL_BINDIR@/3proxy"
|
||||
pidfile="/var/run/3proxy/${name}.pid"
|
||||
command_args="${3proxy_config:-/etc/3proxy/3proxy.cfg}"
|
||||
required_files="${3proxy_config:-/etc/3proxy/3proxy.cfg}"
|
||||
|
||||
start_precmd="3proxy_precmd"
|
||||
|
||||
3proxy_precmd()
|
||||
{
|
||||
if [ ! -d /var/run/3proxy ]; then
|
||||
mkdir -p /var/run/3proxy
|
||||
fi
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
||||
Loading…
Reference in New Issue
Block a user