Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Supervisor Vms
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
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
OpenVMS
tools
Supervisor Vms
Commits
ff9bc7b1e6ce
Commit
ff9bc7b1e6ce
authored
2 years ago
by
jfp
Browse files
Options
Downloads
Patches
Plain Diff
supervisorctl check programs name, password argument for supervisord (not in configuration file)
parent
6c736ee87d45
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
supervisorctl.py
+43
-4
43 additions, 4 deletions
supervisorctl.py
supervisord.conf_template
+0
-2
0 additions, 2 deletions
supervisord.conf_template
supervisord.py
+12
-7
12 additions, 7 deletions
supervisord.py
with
55 additions
and
13 deletions
supervisorctl.py
+
43
−
4
View file @
ff9bc7b1
import
argparse
import
cmd
import
configparser
import
json
...
...
@@ -3,6 +4,6 @@
import
json
from
typing
import
Tuple
,
Any
from
typing
import
Any
,
Tuple
,
Set
from
ovms
import
cmbdef
,
iodef
,
mbxqio
,
psldef
,
starlet
supervisorctl_pwd
=
''
...
...
@@ -5,8 +6,9 @@
from
ovms
import
cmbdef
,
iodef
,
mbxqio
,
psldef
,
starlet
supervisorctl_pwd
=
''
# programs_name: Set[str] = set(('ALL',))
programs_name
:
Set
[
str
]
=
set
()
def
pstat2str
(
s
:
int
)
->
str
:
dstate
=
{
...
...
@@ -63,6 +65,7 @@
return
res
=
self
.
write_cmd
({
'
cmd
'
:
'
shutdown
'
})
print
(
res
)
# return True
def
do_status
(
self
,
arg
):
"""
Display status of programs
"""
...
...
@@ -66,4 +69,5 @@
def
do_status
(
self
,
arg
):
"""
Display status of programs
"""
global
programs_name
lst
=
arg
.
split
()
...
...
@@ -69,4 +73,9 @@
lst
=
arg
.
split
()
for
name
in
lst
:
name
=
name
.
upper
()
if
name
not
in
programs_name
:
print
(
f
'
Invalid program name
{
name
}
'
)
return
jscmd
=
self
.
write_cmd
({
'
cmd
'
:
'
status
'
,
'
programs
'
:
lst
})
if
'
error
'
in
jscmd
:
print
(
jscmd
[
'
error
'
])
...
...
@@ -76,7 +85,8 @@
print
(
pinfo
)
def
do_start
(
self
,
arg
):
global
programs_name
lst
=
arg
.
split
()
if
len
(
lst
)
<
1
:
print
(
'
*** invalid number of arguments
'
)
return
...
...
@@ -79,8 +89,14 @@
lst
=
arg
.
split
()
if
len
(
lst
)
<
1
:
print
(
'
*** invalid number of arguments
'
)
return
lst
=
[
name
.
upper
()
for
name
in
lst
]
if
lst
!=
[
'
ALL
'
,]:
for
name
in
lst
:
if
name
not
in
programs_name
:
print
(
f
'
Invalid program name
{
name
}
'
)
return
res
=
self
.
write_cmd
({
'
cmd
'
:
'
start
'
,
'
programs
'
:
lst
})
print
(
res
)
def
do_stop
(
self
,
arg
):
...
...
@@ -83,8 +99,9 @@
res
=
self
.
write_cmd
({
'
cmd
'
:
'
start
'
,
'
programs
'
:
lst
})
print
(
res
)
def
do_stop
(
self
,
arg
):
global
programs_name
lst
=
arg
.
split
()
if
len
(
lst
)
<
1
:
print
(
'
*** invalid number of arguments
'
)
return
...
...
@@ -87,7 +104,13 @@
lst
=
arg
.
split
()
if
len
(
lst
)
<
1
:
print
(
'
*** invalid number of arguments
'
)
return
lst
=
[
name
.
upper
()
for
name
in
lst
]
if
lst
!=
[
'
ALL
'
,]:
for
name
in
lst
:
if
name
not
in
programs_name
:
print
(
f
'
Invalid program name
{
name
}
'
)
return
res
=
self
.
write_cmd
({
'
cmd
'
:
'
stop
'
,
'
programs
'
:
lst
})
print
(
res
)
...
...
@@ -136,9 +159,9 @@
def
main
():
global
supervisorctl_pwd
global
supervisorctl_pwd
,
programs_name
parser
=
argparse
.
ArgumentParser
(
description
=
'
supervisorctl
'
)
parser
.
add_argument
(
'
-p
'
,
'
--password
'
,
required
=
False
,
...
...
@@ -140,9 +163,9 @@
parser
=
argparse
.
ArgumentParser
(
description
=
'
supervisorctl
'
)
parser
.
add_argument
(
'
-p
'
,
'
--password
'
,
required
=
False
,
#
type=str,
type
=
str
,
default
=
''
,
help
=
'
password for supervisord
'
,
)
...
...
@@ -146,5 +169,12 @@
default
=
''
,
help
=
'
password for supervisord
'
,
)
parser
.
add_argument
(
'
-c
'
,
'
--configuration
'
,
type
=
argparse
.
FileType
(
'
r
'
,
encoding
=
'
latin1
'
),
default
=
'
./supervisord.conf
'
,
help
=
'
Configuration file path (default ./supervisord.conf)
'
,
)
args
,
unknownargs
=
parser
.
parse_known_args
()
supervisorctl_pwd
=
args
.
password
...
...
@@ -149,5 +179,14 @@
args
,
unknownargs
=
parser
.
parse_known_args
()
supervisorctl_pwd
=
args
.
password
config
=
configparser
.
ConfigParser
()
config
.
read_file
(
args
.
configuration
)
args
.
configuration
.
close
()
for
sn
in
config
.
sections
():
if
sn
.
startswith
(
'
program:
'
):
name
=
sn
.
split
(
'
:
'
)[
-
1
].
upper
()
programs_name
.
add
(
name
)
chan
,
chan_r
=
mbx_init
()
with
(
mbxqio
.
MBXQIO
(
channel
=
chan
)
as
mcmd
,
...
...
This diff is collapsed.
Click to expand it.
supervisord.conf_template
+
0
−
2
View file @
ff9bc7b1
[openvms]
password=xxxxxx
[program:firstpgm]
command=dev:[dir]PGM1.COM
process_name=PGM1D
...
...
This diff is collapsed.
Click to expand it.
supervisord.py
+
12
−
7
View file @
ff9bc7b1
...
...
@@ -510,6 +510,8 @@
pid
=
iosb
.
iosb_r_devdepend
.
iosb_r_bcnt_16
.
iosb_l_dev_depend
try
:
pgm
=
Program
.
running_processes
[
pid
]
acc
=
accdef
.
ACCDEF
.
parse
(
res
)
print
(
acc
)
logging
.
info
(
f
'
Program
{
pgm
.
name
}
'
f
'
terminated
{
hex
(
pid
)[
2
:
].
upper
()
}
,
'
...
...
@@ -513,5 +515,5 @@
logging
.
info
(
f
'
Program
{
pgm
.
name
}
'
f
'
terminated
{
hex
(
pid
)[
2
:
].
upper
()
}
,
'
f
'
{
len
(
res
)
}
'
f
'
{
acc
.
acc_l_finalsts
}
'
)
...
...
@@ -517,6 +519,4 @@
)
acc
=
accdef
.
ACCDEF
.
parse
(
res
)
print
(
acc
)
pgm
.
set_terminated
(
acc
.
acc_l_finalsts
,
acc
.
acc_q_termtime
)
if
not
stsdef
.
vms_status_success
(
acc
.
acc_l_finalsts
):
pgm
.
create_process
()
...
...
@@ -626,4 +626,12 @@
default
=
'
./supervisord.conf
'
,
help
=
'
Configuration file path (default ./supervisord.conf)
'
,
)
parser
.
add_argument
(
'
-p
'
,
'
--password
'
,
required
=
False
,
type
=
str
,
default
=
''
,
help
=
'
password for supervisord
'
,
)
args
=
parser
.
parse_args
()
...
...
@@ -629,6 +637,7 @@
args
=
parser
.
parse_args
()
supervisorctl_pwd
=
args
.
password
config
=
configparser
.
ConfigParser
()
config
.
read_file
(
args
.
configuration
)
args
.
configuration
.
close
()
...
...
@@ -630,10 +639,8 @@
config
=
configparser
.
ConfigParser
()
config
.
read_file
(
args
.
configuration
)
args
.
configuration
.
close
()
supervisorctl_pwd
=
config
[
'
openvms
'
].
get
(
'
password
'
,
''
)
for
sn
in
config
.
sections
():
if
sn
.
startswith
(
'
program:
'
):
name
=
sn
.
split
(
'
:
'
)[
-
1
].
upper
()
...
...
@@ -668,5 +675,3 @@
if
__name__
==
'
__main__
'
:
main
()
# rename x.x;v into x.x;1
# os.replace('x.x', 'x.x')
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