-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support
make install
and deb package generate
- Loading branch information
YihaoPeng
committed
May 11, 2018
1 parent
9b48da2
commit 2879eb4
Showing
4 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,4 +30,3 @@ | |
|
||
# build dir & files | ||
/build*/ | ||
/CMakeLists.txt |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,5 +46,32 @@ add_executable(unittest ${TEST_SOURCES}) | |
target_link_libraries(unittest btccomagent ${THRID_LIBRARIES}) | ||
|
||
file(GLOB_RECURSE AGENT_SOURCES src/agent/*.cc) | ||
add_executable(agent ${AGENT_SOURCES}) | ||
target_link_libraries(agent btccomagent ${THRID_LIBRARIES}) | ||
add_executable(btcagent ${AGENT_SOURCES}) | ||
target_link_libraries(btcagent btccomagent ${THRID_LIBRARIES}) | ||
|
||
|
||
# make instal support | ||
install(TARGETS btcagent | ||
DESTINATION /usr/bin) | ||
install(FILES src/agent/agent_conf.json README.md README-zh_CN.md | ||
DESTINATION /etc/btcagent) | ||
install(FILES install/btcagent-single_user.conf | ||
DESTINATION /etc/supervisor/conf.d) | ||
|
||
# generate deb package by CPack | ||
set(CPACK_GENERATOR "DEB") | ||
set(CPACK_PACKAGE_NAME "btcagent-single_user") | ||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "YihaoPeng [email protected]") | ||
|
||
SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/install/debian-control/postinst") | ||
|
||
# version | ||
SET(CPACK_PACKAGE_VERSION_MAJOR "1") | ||
SET(CPACK_PACKAGE_VERSION_MINOR "0") | ||
SET(CPACK_PACKAGE_VERSION_PATCH "0") | ||
|
||
# dependencies | ||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) | ||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "supervisor") | ||
|
||
include(CPack) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[program:btcagent] | ||
directory=/var/log/btcagent | ||
command=/usr/bin/btcagent -c /etc/btcagent/agent_conf.json -l /var/log/btcagent | ||
autostart=true | ||
autorestart=true | ||
startsecs=3 | ||
startretries=2147483647 | ||
|
||
redirect_stderr=true | ||
stdout_logfile_backups=5 | ||
stdout_logfile=/var/log/btcagent/agent_stdout.log |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/sh | ||
|
||
echo "-- create log dir for btcagent" | ||
mkdir /var/log/btcagent | ||
|
||
echo "-- set minfds=65535 in supervisor.conf" | ||
cat /etc/supervisor/supervisord.conf | grep -v 'minfds\s*=' | sed '/\[supervisord\]/a\minfds=65535' | tee /etc/supervisor/supervisord.conf | grep 'minfds\s*=' | ||
|
||
echo "-- start supervisor & running btcagent" | ||
service supervisor start | ||
echo "-- start btcagent" | ||
supervisorctl reread | ||
supervisorctl update | ||
supervisorctl status btcagent | ||
|
||
echo "-- Install successfully." | ||
echo # empty line | ||
echo "-- Usage:" | ||
echo "* Edit config file:" | ||
echo " vim /etc/btcagent/agent_conf.json" | ||
echo "* Start supervisor (daemon service of btcagent)" | ||
echo " service start supervisor" | ||
echo "* Restart btcagent:" | ||
echo " supervisorctl restart btcagent" | ||
echo "* Stop btcagent:" | ||
echo " supervisorctl stop btcagent" | ||
echo "* Show logs:" | ||
echo " tail -F /var/log/btcagent/*INFO" | ||
echo "* Count connections:" | ||
echo " netstat -antp | grep btcagent" |