Fellow listers
A few days ago I received a call for some assistance in installing the latest
version of SLEEPER. One of the problems was the 'lack' of a utility that would
'allow' a number of commands to the user under which their 'backup' job was
running. While trying to locate an 'allow' utility I also kept thinking if
there was a way that the 'allow' functionality could be implemented using a
command file.
I was able to construct a command file that can achieve that, provided that it
is issued by a user with SM capability, the physical console (ldev 20) is
available (no session running on it) and that the desired MPE user is logged on.
I don't know if the attached command file, 'ALLOWCMD', would be of any use to
anyone else and I'm hoping that it will become obsolete when the 'permanent
allow' functionally is finally made available (maybe it already has).
Regards
Paul H. Christidis
parm UserName="?"
anyparm CmdList=allow
comment
comment Author: Paul H. Christidis
comment Date: 07/30/1999 e-mail: [log in to unmask]
comment
comment This command file will create a session on the system console
comment under the manager.sys user and issue the indicated 'allow'
comment commands for the specified user. This will work ONLY if a
comment session is NOT already running on the console (ldev 20) AND
comment the executing user has SM capabilities.
comment The user MUST also be logged on for the allow to take effect.
comment
setvar _allow_user UPS("!UserName")
setvar _allow_bell CHR(7)
echo
echo (PHC) Allow OP Commands V99.08.02 !hpdatef, !hptimef
if _allow_user = "?" then
echo !_allow_bell
echo Usage ![finfo(hpfile,"fname")] UserName [CmdList]
echo
echo UserName - A valid MPE user name (uname.acctname) that is to be
echo 'allowed' the commands in 'CmdList'.
echo
echo CmdList - A list of comma separated commands that are to be
echo 'allowed' to the user. If omitted the 'allow' command
echo will be 'allowed'.
echo
echo NOTE: This will work ONLY if the 'physical' console (ldev 20)
echo is 'available' (No session running on it or being accessed
echo by some other process). 'UserName' MUST also be logged on.
echo
echo Example:
echo ![finfo(hpfile,"fname")] BACKUP.SYS limit,abortjob,jobfence
echo
echo !_allow_bell
return
endif
comment
comment Single thread the requests
comment
setvar _allow_sentinel "alwsntnl.pub.sys"
setvar _allow_cntr 0
setvar _allow_climit 6
while _allow_cntr <> _allow_climit AND finfo(_allow_sentinel,"exists") do
setvar _allow_cntr _allow_cntr + 1
pause 5
endwhile
if _allow_cntr = _allow_climit then
echo !_allow_bell
echo We have a persistent 'sentinel' file: !_allow_sentinel.
echo Investigate and remove before using this command again.
echo !_allow_bell
deletevar _allow@
return
else
build !_allow_sentinel
endif
comment
comment Get passwords for MANAGER.SYS user and the SYS account
comment
listuser manager.sys;pass;format=detail > $newpass
print $oldpass;start=3;end=3;out=$newpass
input pass_text < $oldpass
setvar u_pass RTRIM(LTRIM(STR(pass_text,POS(":",pass_text)+1,10)))
comment
listacct sys;pass;format=detail > $newpass
print $oldpass;start=3;end=3;out=$newpass
input pass_text < $oldpass
setvar a_pass RTRIM(LTRIM(STR(pass_text,POS(":",pass_text)+1,10)))
comment
comment Build datafile and place in it the needed commands
comment
setvar _allow_console hpconsole
setvar _allow_cmds UPS("!CmdList")
setvar _allow_jobname "al!hpjobnum!hpjobtype"
setvar _allow_file "!_allow_jobname.pub.sys"
purge !_allow_file >$null
file allowdat=!_allow_file;dev=disc;rec=-256,,v,ascii
comment
echo pause 2 >> *allowdat
echo continue >> *allowdat
echo allow !_allow_user;commands=!_allow_cmds >> *allowdat
echo continue >> *allowdat
if hpconsole <> 20
echo console !hpconsole >> *allowdat
endif
echo exit >> *allowdat
save !_allow_file
comment
comment Start session on console, have it execute 'allow_data' file.
comment
if hpconsole <> 20 then
console 20
endif
setjcw cierror = 0
continue
startsess 20;!_allow_jobname,manager/!u_pass.sys/!a_pass;hipri;&
nowait;parm=-1;info="!_allow_file" >$null
if cierror <> 0 then
echo !_allow_bell Cannot access console to perform task....
echo !hpcierrmsg
echo !_allow_bell
if hpconsole <> _allow_console then
console !_allow_console
endif
endif
pause job="!_allow_jobname,manager.sys"
comment
# Clean up variables and data files
comment
if BOUND(traceon) then
showvar _allow@, u_pass, a_pass
print !_allow_file
endif
comment
purge !_allow_sentinel >$null
purge !_allow_file >$null
purge $oldpass >$null
deletevar _allow@, u_pass, a_pass, pass_text
|