Skip to content

Commit

Permalink
fusioninventory-agent init.d script
Browse files Browse the repository at this point in the history
  • Loading branch information
joschi99 committed Oct 26, 2016
1 parent 66aa682 commit bb16e73
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions os customizing/etc/init.d/fusioninventory-agent
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/sh
# FusionInventory-Agent - this script starts and stops the FusionInventory Agent
# Created by Jochen Platzgummer (c)2014
#
# chkconfig: - 85 15
# description: FusionInventory Agent
# processname: fusioninventory-agent
# config: /usr/local/fusioninventory-agent/etc/fusioninventory/agent.cfg
# pidfile: /usr/local/fusioninventory-agent/var/fusioninventory/fusioninventory.pid

# Source function library.
. /etc/rc.d/init.d/functions

OPTIONS="--conf-file /usr/local/fusioninventory-agent/etc/fusioninventory/agent.cfg -d"
RETVAL=0
prog="FusionInventory-Agent"
DAEMON=/usr/local/fusioninventory-agent/bin/fusioninventory-agent

lockfile=/var/lock/subsys/fusioninventory-agent
pidfile=/usr/local/fusioninventory-agent/var/fusioninventory/fusioninventory.pid

start() {
echo -n $"Starting $prog: "
daemon ${DAEMON} $OPTIONS
RETVAL=$?
echo
touch $lockfile
return $RETVAL
}


stop() {
echo -n $"Stopping $prog: "
killproc ${DAEMON} 2>/dev/null
RETVAL=$?
echo
# rm -f $lockfile
# if test -f /usr/local/fusioninventory-agent/var/fusioninventory/fusioninventory-agent.pid ; then
# [ $RETVAL -eq 0 ] && rm -f /usr/local/fusioninventory-agent/var/fusioninventory/fusioninventory-agent.pid
# fi
if [ $RETVAL -eq 0 ] ; then
rm -f $lockfile $pidfile
fi
return $RETVAL
}

restart() {
stop
start
}

rh_status() {
status $prog
}

rh_status_q() {
rh_status >/dev/null 2>&1
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status fusioninventory-agent
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
RETVAL=1
esac

exit $RETVAL

0 comments on commit bb16e73

Please sign in to comment.