Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dm-docs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hammonds
dm-docs
Commits
690797a5
Commit
690797a5
authored
8 years ago
by
sveseli
Browse files
Options
Downloads
Patches
Plain Diff
add proc web service control script
parent
32932aa6
No related branches found
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
etc/init.d/dm-proc-web-service
+128
-0
128 additions, 0 deletions
etc/init.d/dm-proc-web-service
with
128 additions
and
0 deletions
etc/init.d/dm-proc-web-service
0 → 100755
+
128
−
0
View file @
690797a5
#!/bin/bash
#
# dm-proc-web-service
#
# Starts the DM PROC WebService daemon
#
# chkconfig: 345 98 98
# description: controls DM PROC Web Service daemon
### BEGIN INIT INFO
# Provides: dm-proc-web-service
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Controls DM PROC Web Service daemon
### END INIT INFO
# Source function library.
.
/etc/rc.d/init.d/functions
# Arguments
ACTION
=
$1
DM_DB_NAME
=
$2
DM_DB_NAME
=
${
DM_DB_NAME
:
=dm
}
# Set root to default if needed.
MY_DIR
=
`
dirname
$0
`
&&
cd
$MY_DIR
&&
MY_DIR
=
`
pwd
`
if
[
-z
"
${
DM_ROOT_DIR
}
"
]
;
then
DM_ROOT_DIR
=
$MY_DIR
/../..
fi
# Source environment file.
DM_USER
=
`
id
-nu
`
DM_HOST
=
`
hostname
-s
`
DM_ENV_FILE
=
${
DM_ROOT_DIR
}
/setup.sh
if
[
!
-f
${
DM_ENV_FILE
}
]
;
then
echo
"Environment file
${
DM_ENV_FILE
}
does not exist."
exit
2
fi
.
${
DM_ENV_FILE
}
>
/dev/null
mkdir
-p
${
DM_INSTALL_DIR
}
/var/run
mkdir
-p
${
DM_INSTALL_DIR
}
/var/log
DM_DAEMON_NAME
=
"
${
DM_DB_NAME
}
.ProcWebService"
DM_DAEMON_CMD
=
${
DM_ROOT_DIR
}
/sbin/procWebService.py
DM_PID_FILE
=
${
DM_INSTALL_DIR
}
/var/run/
${
DM_DB_NAME
}
.proc-web-service.pid
DM_CONFIG_FILE
=
${
DM_INSTALL_DIR
}
/etc/
${
DM_DB_NAME
}
.proc-web-service.conf
DM_DAEMON_START_ARGS
=
"-d -p
$DM_PID_FILE
--config-file
$DM_CONFIG_FILE
"
# Determine su command
SU
=
su
if
[
-x
/sbin/runuser
]
;
then
SU
=
runuser
fi
RETVAL
=
0
start
()
{
# Check if service is already running
status
-p
$DM_PID_FILE
>
/dev/null 2>&1
if
[
$?
-eq
0
]
;
then
PID
=
`
cat
$DM_PID_FILE
`
echo
$"
$DM_DAEMON_NAME
daemon is already running (pid:
$PID
)."
RETVAL
=
1
return
$RETVAL
fi
echo
-n
$"Starting
$DM_DAEMON_NAME
daemon: "
# Check if we're a privileged user
if
[
`
id
-u
`
=
0
-a
${
DM_USER
}
!=
"root"
]
;
then
$SU
-m
-c
"
${
DM_DAEMON_CMD
}
${
DM_DAEMON_START_ARGS
}
"
${
DM_USER
}
else
${
DM_DAEMON_CMD
}
${
DM_DAEMON_START_ARGS
}
fi
RETVAL
=
$?
[
$RETVAL
-eq
0
]
&&
success
$"
$DM_DAEMON_NAME
startup"
||
failure
$"
$DM_DAEMON_NAME
startup"
echo
return
$RETVAL
}
stop
()
{
# Check if service is already running
status
-p
$DM_PID_FILE
>
/dev/null 2>&1
if
[
$?
-ne
0
]
;
then
echo
$"
$DM_DAEMON_NAME
daemon is not running."
RETVAL
=
1
return
$RETVAL
fi
echo
-n
$"Stopping
$DM_DAEMON_NAME
daemon: "
PID
=
`
cat
$DM_PID_FILE
`
kill
$PID
RETVAL
=
$?
sleep
1
# Make sure we kill the process always, regardless of
# what happened with first kill
kill
-KILL
$PID
>
/dev/null 2>&1
[
$RETVAL
-eq
0
]
&&
rm
-f
$DM_PID_FILE
&&
success
$"
$DM_DAEMON_NAME
shutdown"
||
failure
$"
$DM_DAEMON_NAME
shutdown"
echo
return
$RETVAL
}
restart
()
{
stop
sleep
1
start
}
case
"
$ACTION
"
in
start
)
start
;;
stop
)
stop
;;
restart
)
restart
;;
status
)
status
-p
$DM_PID_FILE
"
$DM_DAEMON_NAME
"
2> /dev/null
RETVAL
=
$?
;;
*
)
echo
$"Usage:
$0
{start|stop|status|restart}"
RETVAL
=
2
esac
exit
$RETVAL
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment