Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
12aa19c0
Commit
12aa19c0
authored
19 years ago
by
Jean-Damien Durand
Committed by
Steven Murray
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
initscript files now have the name of the daemon they are starting
parent
e236cb88
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mediachanger/castorrmc/rmc/rmcdaemon.init
+249
-0
249 additions, 0 deletions
mediachanger/castorrmc/rmc/rmcdaemon.init
with
249 additions
and
0 deletions
mediachanger/castorrmc/rmc/rmcdaemon.init
0 → 100755
+
249
−
0
View file @
12aa19c0
#!/bin/sh
#
# rmcdaemon Start/Stop rmcdaemon.
#
# chkconfig: 345 71 34
# description: RMC server daemon
#
# $Id: rmcdaemon.init,v 1.1 2005/06/17 08:04:25 jdurand Exp $
#
# @(#)$RCSfile: rmcdaemon.init,v $ $Revision: 1.1 $ $Date: 2005/06/17 08:04:25 $ CERN/IT/ADC/CA Jean-Damien Durand
#
sysname
=
`
uname
-s
`
# source function library
if
[
-r
/etc/rc.d/init.d/functions
]
;
then
.
/etc/rc.d/init.d/functions
DAEMON
=
daemon
FAILURE
=
failure
ECHO_FAILURE
=
failure
SUCCESS
=
success
ECHO_SUCCESS
=
echo_success
ECHO_END
=
echo
if
[
$sysname
=
"Linux"
]
;
then
ECHOOPT
=
-n
fi
else
DAEMON
=
FAILURE
=
ECHO_FAILURE
=
SUCCESS
=
ECHO_SUCCESS
=
ECHOOPT
=
ECHO_END
=
fi
RETVAL
=
0
prog
=
"rmcdaemon"
PIDFILE
=
/var/run/rmcdaemon.pid
PIDDIR
=
/var/run
SUBSYS
=
/var/lock/subsys/rmcdaemon
SUBSYSDIR
=
/var/lock/subsys
[
-z
"
$SILENTSTOP
"
]
&&
SILENTSTOP
=
0
if
[
-z
"
$MYPGID
"
]
;
then
MYPGID
=
$PPID
export
MYPGID
fi
MYPID
=
$$
RMCDAEMON
=
/usr/bin/rmcdaemon
OPTIONS
=
""
SYSCONFIGRMCDAEMON
=
/etc/sysconfig/rmcdaemon
#
## Blindly attempt to create useful directories
#
[
!
-d
$PIDDIR
]
&&
mkdir
-p
$PIDDIR
>
& /dev/null
[
!
-d
$SUBSYSDIR
]
&&
mkdir
-p
$SUBSYSDIR
>
& /dev/null
if
[
$sysname
=
"HP-UX"
]
;
then
export
UNIX95
=
1
fi
if
[
$sysname
=
"SunOS"
]
;
then
format4comm
=
"fname"
else
format4comm
=
"comm"
fi
#
## Unless sysconfig says no the default is to run the server
#
RUN_RMCDAEMON
=
yes
case
"
$1
"
in
start
)
echo
$ECHOOPT
"Starting
$prog
: "
if
[
$sysname
=
"Linux"
-a
`
whoami
`
=
"root"
]
;
then
netstat
-ap
| egrep
'\*:5014|\*:rmc'
|
grep
LISTEN |
grep
rmcdaemon
>
/dev/null
else
netstat
-a
| egrep
'\*:5014|\*:rmc'
| egrep
'LISTEN *$'
>
/dev/null
fi
# ps -eo ppid,$format4comm | egrep '^[ \t]+1 rmcdaemon' > /dev/null
if
[
$?
-eq
0
]
;
then
echo
$ECHOOPT
"rmcdaemon already started: "
[
-n
"
$FAILURE
"
]
&&
$FAILURE
"rmcdaemon already started: "
RETVAL
=
1
else
if
[
-r
$SYSCONFIGRMCDAEMON
]
;
then
#
## Source the configuration
#
.
$SYSCONFIGRMCDAEMON
if
[
"
${
RUN_RMCDAEMON
}
"
!=
"yes"
]
;
then
echo
$ECHOOPT
"
$SYSCONFIGRMCDAEMON
says NO: "
[
-n
"
$FAILURE
"
]
&&
$FAILURE
"
$SYSCONFIGRMCDAEMON
says NO: "
RETVAL
=
1
fi
if
[
-n
"
${
ULIMIT_N
}
"
]
;
then
ulimit
-n
${
ULIMIT_N
}
fi
fi
if
[
$RETVAL
-eq
0
-a
-z
"
${
OPTIONS
}
"
]
;
then
#
## We require a parameter, to be in the sysconfig file
#
echo
$ECHOOPT
"No option (should be a device name): "
[
-n
"
$FAILURE
"
]
&&
$FAILURE
"No option (should be a device name): "
RETVAL
=
1
fi
if
[
$RETVAL
-eq
0
]
;
then
#
## Because we might generate a core file
## We explicitely chdir in the workdir
#
cd
/var/spool/rmc
$DAEMON
$RMCDAEMON
$OPTIONS
if
[
$?
-eq
0
]
;
then
[
-d
$SUBSYSDIR
]
&&
touch
$SUBSYS
if
[
-d
$PIDDIR
]
;
then
pid
=
`
ps
-eo
pid,ppid,
$format4comm
|
grep
" 1 rmcdaemon"
|
awk
'{print $1}'
`
# The point of $PIDFILE is that it kills only
# the master daemon.
rm
-f
$PIDFILE
if
[
-n
"
$pid
"
]
;
then
echo
$pid
>
$PIDFILE
RETVAL
=
0
else
echo
$ECHOOPT
"rmcdaemon not started: "
[
-n
"
$FAILURE
"
]
&&
$FAILURE
"rmcdaemon not started: "
RETVAL
=
1
fi
else
RETVAL
=
0
fi
else
echo
$ECHOOPT
"rmcdaemon not started: "
[
-n
"
$FAILURE
"
]
&&
$FAILURE
"rmcdaemon not started: "
RETVAL
=
1
fi
fi
fi
$ECHO_END
;;
stop
)
if
[
-f
$PIDFILE
]
;
then
[
$SILENTSTOP
-eq
0
]
&&
echo
$ECHOOPT
"Stopping
$prog
: "
if
[
$SILENTSTOP
-eq
0
]
;
then
kill
-9
`
cat
$PIDFILE
`
else
kill
-9
`
cat
$PIDFILE
`
>
& /dev/null
fi
RETVAL
=
$?
if
[
$RETVAL
-eq
0
]
;
then
rm
-f
$PIDFILE
fi
else
# rmcdaemon might have been started by hand
pid
=
`
ps
-eo
pid,ppid,
$format4comm
|
grep
" 1 rmcdaemon"
|
awk
'{print $1}'
`
if
[
-n
"
$pid
"
]
;
then
[
$SILENTSTOP
-eq
0
]
&&
echo
$ECHOOPT
"Stopping
$prog
: "
if
[
$SILENTSTOP
-eq
0
]
;
then
kill
-9
$pid
else
kill
-9
$pid
>
& /dev/null
fi
RETVAL
=
$?
#
## Kill any other instance of rmcdaemon
#
else
[
$SILENTSTOP
-eq
0
]
&&
echo
$ECHOOPT
"rmcdaemon already stopped: "
[
$SILENTSTOP
-eq
0
-a
-n
"
$FAILURE
"
]
&&
$FAILURE
"rmcdaemon already stopped: "
RETVAL
=
1
fi
fi
if
[
$SILENTSTOP
-eq
0
-a
$sysname
=
"Linux"
]
;
then
if
[
$RETVAL
-eq
0
]
;
then
$ECHO_SUCCESS
else
$ECHO_FAILURE
fi
fi
[
-d
$SUBSYSDIR
]
&&
rm
-f
$SUBSYS
[
$SILENTSTOP
-eq
0
-a
-n
"
$ECHO_END
"
]
&&
$ECHO_END
#
## Basically: if SILENTSTOP is not 0 when we never print something
## But if the stop is successful... One might want to see stop: OK
## anyway ?
#
if
[
$SILENTSTOP
-ne
0
-a
$RETVAL
-eq
0
]
;
then
echo
$ECHOOPT
"Stopping
$prog
: "
[
$sysname
=
"Linux"
]
&&
$ECHO_SUCCESS
[
-n
"
$ECHO_END
"
]
&&
$ECHO_END
fi
;;
restart
)
$0
stop
if
[
$?
-eq
0
-o
$SILENTSTOP
-eq
0
]
;
then
$0
start
RETVAL
=
$?
else
#
## It is legal to return zero it if was
## a conditional restart
#
if
[
$SILENTSTOP
-eq
0
]
;
then
RETVAL
=
1
else
RETVAL
=
0
fi
fi
;;
condrestart
)
SILENTSTOP
=
1
export
SILENTSTOP
$0
restart
RETVAL
=
$?
;;
status
)
pid
=
`
ps
-eo
pid,ppid,
$format4comm
|
grep
" 1 rmcdaemon"
|
awk
'{print $1}'
|
head
-1
`
if
[
-n
"
$pid
"
]
;
then
echo
$ECHOOPT
"rmcdaemon (pid
$pid
) is running..."
$ECHO_SUCCESS
$ECHO_END
else
if
[
-f
$PIDFILE
]
;
then
pid
=
`
head
-1
$PIDFILE
`
if
[
"
$pid
"
!=
""
]
;
then
echo
$ECHOOPT
"rmcdaemon dead but pid file exists"
$ECHO_FAILURE
$ECHO_END
fi
else
if
[
-f
$SUBSYS
]
;
then
echo
$ECHOOPT
"rmcdaemon dead but subsys (
$SUBSYS
) locked"
else
echo
$ECHOOPT
"rmcdaemon is stopped"
fi
$ECHO_FAILURE
$ECHO_END
fi
fi
;;
*
)
echo
"Usage:
$0
{start|stop|status|restart|condrestart}"
RETVAL
=
1
;;
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