Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
eth-log-alerting
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Server Tools
eth-log-alerting
Commits
52ebf7d3
Commit
52ebf7d3
authored
8 years ago
by
Erick Hitter
Browse files
Options
Downloads
Patches
Plain Diff
Switch to pure systemd
parent
bca3aa0b
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+4
-3
4 additions, 3 deletions
README.md
init.sh
+0
-81
0 additions, 81 deletions
init.sh
service.sh
+18
-0
18 additions, 0 deletions
service.sh
systemd.service
+8
-0
8 additions, 0 deletions
systemd.service
with
30 additions
and
84 deletions
README.md
+
4
−
3
View file @
52ebf7d3
...
...
@@ -9,8 +9,9 @@ Pipe logs to Mattermost or Slack webhooks
# Installation
1.
`git clone https://git.ethitter.com/debian/eth-log-alerting.git /usr/local/eth-log-alerting`
2.
`cp /usr/local/eth-log-alerting/
init.sh /etc/init.d
/eth_log_alerting`
2.
`cp /usr/local/eth-log-alerting/
systemd.service /etc/systemd/system
/eth_log_alerting
.service
`
3.
`cp /usr/local/eth-log-alerting/defaults /etc/default/eth_log_alerting`
4.
Edit
`/etc/default/eth_log_alerting`
5.
`sudo update-rc.d eth_log_alerting defaults`
6.
`/etc/init.d/eth_log_alerting start`
5.
`systemctl daemon-reload`
6.
`systemctl enable eth_log_alerting.service`
6.
`systemctl start eth_log_alerting.service`
This diff is collapsed.
Click to expand it.
init.sh
deleted
100755 → 0
+
0
−
81
View file @
bca3aa0b
#!/bin/sh
### BEGIN INIT INFO
# Provides: eth_log_alerting
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Log entry alerting
### END INIT INFO
set
-e
.
/lib/lsb/init-functions
DAEMON
=
"/usr/local/eth-log-alerting/pipe.sh"
NAME
=
"eth_log_alerting"
DESC
=
"log alerting"
DAEMON_OPTIONS
=
PID
=
"/run/
$NAME
.pid"
# Check if DAEMON binary exist
[
-f
$DAEMON
]
||
exit
0
[
-f
"/etc/default/
$NAME
"
]
&&
.
/etc/default/
$NAME
daemon_not_configured
()
{
if
[
"
$1
"
!=
"stop"
]
then
log_daemon_msg
"Configuration required! Update /etc/default/
$NAME
"
exit
0
fi
}
config_checks
()
{
# Check that log is configured
if
[
-z
"
$DAEMON_OPTIONS
"
]
then
daemon_not_configured
"
$1
"
fi
}
case
"
$1
"
in
start
)
log_daemon_msg
"Starting
$DESC
"
"
$NAME
"
config_checks
"
$1
"
if
start-stop-daemon
--start
--quiet
--oknodo
--pidfile
$PID
--exec
$DAEMON
--
$DAEMON_OPTIONS
1>/dev/null
then
log_end_msg 0
else
log_end_msg 1
fi
;;
stop
)
log_daemon_msg
"Stopping
$DESC
"
"
$NAME
"
if
start-stop-daemon
--retry
TERM/5/KILL/5
--oknodo
--stop
--quiet
--pidfile
$PID
1>/dev/null
then
log_end_msg 0
else
log_end_msg 1
fi
;;
restart
)
log_daemon_msg
"Restarting
$DESC
"
"
$NAME
"
start-stop-daemon
--retry
TERM/5/KILL/5
--oknodo
--stop
--quiet
--pidfile
$PID
1>/dev/null
if
start-stop-daemon
--start
--quiet
--oknodo
--pidfile
$PID
--exec
$DAEMON
--
$DAEMON_OPTIONS
1>/dev/null
then
log_end_msg 0
else
log_end_msg 1
fi
;;
status
)
status_of_proc
-p
$PID
$DAEMON
$NAME
;;
*
)
log_action_msg
"Usage: /etc/init.d/
$NAME
{start|stop|restart|status}"
;;
esac
exit
0
This diff is collapsed.
Click to expand it.
service.sh
0 → 100755
+
18
−
0
View file @
52ebf7d3
#!/bin/sh
DAEMON
=
"/usr/local/eth-log-alerting/pipe.sh"
NAME
=
"eth_log_alerting"
# Check if DAEMON binary exist
[
-f
$DAEMON
]
||
exit
0
# Check if config exists
if
[
-f
"/etc/default/
$NAME
"
]
then
.
/etc/default/
$NAME
else
exit
0
fi
# On with it!
$DAEMON
$DAEMON_OPTIONS
This diff is collapsed.
Click to expand it.
systemd.service
0 → 100644
+
8
−
0
View file @
52ebf7d3
[Unit]
After
=
network.target
[Service]
ExecStart
=
/usr/local/eth-log-alerting/service.sh
[Install]
WantedBy
=
default.target
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment