#!/bin/sh
### BEGIN INIT INFO
# Provides:          swstartupsvr
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:		 1
# Short-Description: start and stop suwell update service node
# Description:       swstartupsvr
### END INIT INFO
# -*- coding: utf-8 -*-
# Debian init.d script for swstartupsvr
# Copyright © 2020 suwell <suwell1@suwell.cn>
# Copyright © 2020 suwell <suwell2@suwell.cn>

set -e

SWSERVICE=/etc/xdg/autostart/SuwellUpdateService
SCRIPTNAME=/etc/init.d/swstartupsvr
#SW_STARTUP_SVR_LOG="/opt/z_test.log"

case "$1" in
  start)
  echo 'start...'
  if [ -f "${SWSERVICE}" ]; then	
	#nohup "${SWSERVICE}" >> "/opt/z_test.log" 2>&1 &
	#nohup "./etc/xdg/autostart/SuwellUpdateService" >> "${SW_STARTUP_SVR_LOG}" 2>&1 &
	#nohup "/etc/xdg/autostart/SuwellUpdateService" >> "${SW_STARTUP_SVR_LOG}" 2>&1 &
	nohup "/etc/xdg/autostart/SuwellUpdateService" 2>&1 &
  fi  
  ;;
  stop)
  echo 'stop...'
  ;;
  reload|force-reload)
  echo 'reload...'
  ;;
  restart)
  echo 'restart...'
  ;;
  status)
  echo 'status...'
  ;;
  *)
  echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
  exit 3
  ;;
esac
exit 0
