Files
tms-arch-linux-calamares-in…/archiso/airootfs/home/smart/SmartOrganizer/SOService
2025-11-23 15:33:54 +08:00

83 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
#
# SOS Start/Stop the smart organizer service.
#
# chkconfig: 2345 95 40
# description: SOS smart organizer service
#
SCRIPT_PATH="/home/smart/SmartOrganizer"
SCRIPT_FILE="SODaemon"
LOG_FILE="${SCRIPT_PATH}/SmartOrganizer.log"
getpid() {
echo `ps axu | grep $1 | grep -v grep | awk '{print $2}'`
}
help() {
echo "help"
}
status() {
PID=`getpid ${SCRIPT_FILE}`
if [[ -z ${PID} ]]; then
echo "Not running..."
else
echo "Running at [${PID}]"
fi
}
stop() {
PID=`getpid ${SCRIPT_FILE}`
if [[ -z ${PID} ]]; then
echo "Not running..."
else
kill ${PID}
echo "PID:${PID} stopped!"
fi
}
start() {
echo "Starting..."
/bin/bash ${SCRIPT_PATH}/${SCRIPT_FILE} >> ${LOG_FILE} 2>&1 &
PID=`getpid ${SCRIPT_FILE}`
echo "Running at ${PID}"
}
restart() {
stop
start
}
version() {
if [[ -f ${SCRIPT_PATH}/.version ]]; then
cat ${SCRIPT_PATH}/.version
fi
}
case "$1" in
-h|--help)
help
;;
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
version)
version
;;
*)
echo ""
;;
esac