I've created init script start,stop,restart&status to handle the service.
# vi /tmp/myscript.sh
Copy below lines on myscript.sh.
#! /bin/sh
### BEGIN INIT INFO
# Provides: opensource Daemon
# Required-Start:
# Required-Stop:
# Default-Start: 2
# Default-Stop: 1
# Short-Description: Validity Finger Print service Daemon
# Description: This Service is used for validity fingerprint sensor.
### END INIT INFO
# Author: Validity Biometrics Pvt Ltd.
#
# Do NOT "set -e"
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="validity Fingerprint Sensor daemon"
NAME=vcsFPService
DAEMON=/usr/bin/$NAME
case "$1" in
start)
echo -n "Starting vcsFPService."
/etc/init.d/$NAME > /dev/null 2>&1 &
;;
stop)
echo -n "Stopping vcsFPService."
killall -9 $NAME
;;
restart)
echo "Stopping vcsFPService."
killall -9 $NAME
echo "."
echo "Starting vcsFPService."
/etc/init.d/$NAME > /dev/null 2>&1 &
;;
status)
echo "$NAME running"
if pidof -o %PPID $NAME> /dev/null; then
exit 0
else
echo "$NAME is not running"
exit 1
fi
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
Provide permission to the file will be a executable mode.
# chmod 755 /tmp/myscript.sh
linux, Linux Box, Linux Desktop, Linux Distribution, Linux Distributions, Linux Distros, Linux Drivers, Linux for Newb's, Linux Geek, Linux Journal, Linux Machine, Linux News, Linux Operating System, Linux Server, Linux Servers, Linux Shell, Linux Tutorials, Linux Users, Linux Version, Linux Video,Linux Windows, Linux Wine, Little Bit, Localhost, Local Host Logging, Logic, Logs, Long Time, Netbook, Networking, Open Linux, Open Office, Open Source, Open Source Application, Open Source, Community, Open Source Developers, Open Source Software, Open Ssh, Operating System, Operating Systems, Optimization,
# vi /tmp/myscript.sh
Copy below lines on myscript.sh.
#! /bin/sh
### BEGIN INIT INFO
# Provides: opensource Daemon
# Required-Start:
# Required-Stop:
# Default-Start: 2
# Default-Stop: 1
# Short-Description: Validity Finger Print service Daemon
# Description: This Service is used for validity fingerprint sensor.
### END INIT INFO
# Author: Validity Biometrics Pvt Ltd.
#
# Do NOT "set -e"
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="validity Fingerprint Sensor daemon"
NAME=vcsFPService
DAEMON=/usr/bin/$NAME
case "$1" in
start)
echo -n "Starting vcsFPService."
/etc/init.d/$NAME > /dev/null 2>&1 &
;;
stop)
echo -n "Stopping vcsFPService."
killall -9 $NAME
;;
restart)
echo "Stopping vcsFPService."
killall -9 $NAME
echo "."
echo "Starting vcsFPService."
/etc/init.d/$NAME > /dev/null 2>&1 &
;;
status)
echo "$NAME running"
if pidof -o %PPID $NAME> /dev/null; then
exit 0
else
echo "$NAME is not running"
exit 1
fi
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
Provide permission to the file will be a executable mode.
# chmod 755 /tmp/myscript.sh
linux, Linux Box, Linux Desktop, Linux Distribution, Linux Distributions, Linux Distros, Linux Drivers, Linux for Newb's, Linux Geek, Linux Journal, Linux Machine, Linux News, Linux Operating System, Linux Server, Linux Servers, Linux Shell, Linux Tutorials, Linux Users, Linux Version, Linux Video,Linux Windows, Linux Wine, Little Bit, Localhost, Local Host Logging, Logic, Logs, Long Time, Netbook, Networking, Open Linux, Open Office, Open Source, Open Source Application, Open Source, Community, Open Source Developers, Open Source Software, Open Ssh, Operating System, Operating Systems, Optimization,
This comment has been removed by the author.
ReplyDeleteWhen i run the sript, the terminal shows: ./myscript.sh: command not found
ReplyDelete