mirror of
https://github.com/openappsec/openappsec.git
synced 2025-09-29 19:24:26 +03:00
First release of open-appsec source code
This commit is contained in:
8
nodes/orchestration/package/service/x86/ubuntu14/nano_agent.conf
Executable file
8
nodes/orchestration/package/service/x86/ubuntu14/nano_agent.conf
Executable file
@@ -0,0 +1,8 @@
|
||||
description "CP_Nano_Linux_Agent"
|
||||
author "NGEN team, Check Point Technologies LTD."
|
||||
|
||||
start on filesystem
|
||||
|
||||
respawn
|
||||
|
||||
exec /etc/cp/watchdog/cp-nano-watchdog
|
82
nodes/orchestration/package/service/x86/ubuntu14/nano_agent.init
Executable file
82
nodes/orchestration/package/service/x86/ubuntu14/nano_agent.init
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: nano_agent
|
||||
# Required-Start: $local_fs $network $named $time $syslog
|
||||
# Required-Stop: $local_fs $network $named $time $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Description: Check Point Linux Nano Agent
|
||||
### END INIT INFO
|
||||
|
||||
START=99
|
||||
SCRIPT="/etc/cp/watchdog/cp-nano-watchdog"
|
||||
|
||||
PIDFILE=/var/run/nano_agent.pid
|
||||
LOGFILE=/var/log/nano_agent.log
|
||||
SERVICE_NAME=nano_agent
|
||||
|
||||
start() {
|
||||
if [ -f $PIDFILE ] && [ -s $PIDFILE ] && kill -0 $(cat $PIDFILE); then
|
||||
echo 'Service already running' >&2
|
||||
return 1
|
||||
fi
|
||||
echo 'Starting service ' $SERVICE_NAME >&2
|
||||
$SCRIPT > $LOGFILE 2>&1 &
|
||||
echo $! > $PIDFILE
|
||||
|
||||
sleep 2
|
||||
PID=$(cat $PIDFILE)
|
||||
if pgrep -f $SERVICE_NAME > /dev/null
|
||||
then
|
||||
echo "$SERVICE_NAME is now running, the PID is $PID"
|
||||
else
|
||||
echo ''
|
||||
echo "Error! Could not start $SERVICE_NAME!"
|
||||
fi
|
||||
}
|
||||
|
||||
stop() {
|
||||
if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then
|
||||
echo 'Service not running' >&2
|
||||
return 1
|
||||
fi
|
||||
echo 'Stopping service $SERVICE_NAME' >&2
|
||||
kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE"
|
||||
echo 'Service stopped' >&2
|
||||
}
|
||||
|
||||
status() {
|
||||
printf "%-50s" "Checking $SERVICE_NAME"
|
||||
if [ -f $PIDFILE ] && [ -s $PIDFILE ]; then
|
||||
PID=$(cat $PIDFILE)
|
||||
if [ -z "$(ps axf | grep ${PID} | grep -v grep)" ]; then
|
||||
printf "%s\n" "The process appears to be dead but pidfile still exists"
|
||||
else
|
||||
echo "Running, the PID is $PID"
|
||||
fi
|
||||
else
|
||||
printf "%s\n" "Service not running"
|
||||
fi
|
||||
}
|
||||
|
||||
boot() {
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|status|restart}"
|
||||
esac
|
11
nodes/orchestration/package/service/x86/ubuntu16/nano_agent.service
Executable file
11
nodes/orchestration/package/service/x86/ubuntu16/nano_agent.service
Executable file
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=CP_Nano_Linux_Agent
|
||||
Before=network-pre.target
|
||||
Wants=network-pre.target
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
[Service]
|
||||
Restart=on-failure
|
||||
EnvironmentFile=/etc/environment
|
Reference in New Issue
Block a user