Skip to content

Commit

Permalink
Add openrc init script and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
jakedipity committed Jan 10, 2018
1 parent 60fd030 commit cb47841
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion logdna-agent.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<metadata>
<id>logdna-agent</id>
<title>LogDNA Agent for Windows</title>
<version>1.4.9</version>
<version>1.4.10</version>
<authors>sedouard,leeliu</authors>
<owners>leeliu</owners>
<summary>LogDNA Collector Agent for Windows</summary>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "logdna-agent",
"version": "1.4.9",
"version": "1.4.10",
"description": "LogDNA Collector Agent",
"main": "index.js",
"scripts": {
Expand Down
30 changes: 30 additions & 0 deletions scripts/openrc-init
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/sbin/openrc-run

name="logdna-agent"
command="/usr/bin/${name}"
pid_file="/var/run/${name}.pid"
log_file="/var/log/${name}.log"
conf_file="/etc/logdna.conf"

check_config() {
if [ ! -f "${conf_file}" ]; then
eerror "Error: LogDNA Ingestion Key is not set! use ${name} -k to set or ${name} -h for help."
return 1
fi
return 0
}

start() {
ebegin "Starting ${name}"
check_config || return 1
chmod 0644 /etc/logrotate.d/"${name}" > /dev/null 2>&1
start-stop-daemon --background --start --exec "${command}" \
--make-pidfile --pidfile "${pid_file}" >> "${log_file}" 2>&1
eend $?
}

stop() {
ebegin "Stopping ${name}"
start-stop-daemon --stop --name "logdna-agent" --exec "${command}"
eend $?
}

0 comments on commit cb47841

Please sign in to comment.