.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Sudoscript 3pm" .TH Sudoscript 3pm "2004-11-22" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" Sudoscript.pm .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Sudoscript; \& my $ss=Sudoscript->new(); \& .. do stuff with $ss .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" A module to implement some common attributes and methods shared between sudoshell and sudoscriptd. See \fIsudoscript\fR\|(8), \&\fIsudoscriptd\fR\|(8) and \fIsudoshell\fR\|(1) for descriptions of the sudoscript system. .PP This module implements routines that .IP "\(bu" 4 Set up the execution environment based on the running \s-1OS\s0 .IP "\(bu" 4 Return command names with switches tuned for the running \s-1OS\s0 .IP "\(bu" 4 Check to see if sudoscriptd is running .IP "\(bu" 4 Return date stamp strings in one of several formats .IP "\(bu" 4 Close standard I/O channels for daemons, redirecting \s-1STDERR\s0 to log files. .PP The following sections docment these routimnes more fully. .SH "Constructor" .IX Header "Constructor" The constructor is called \fInew()\fR. It does the usual \s-1OO\s0 style initialization, then returns the result of calling \fI_init()\fR; .PP The \fI_init()\fR routine: .IP "\(bu" 4 Initializes the local time zone names .IP "\(bu" 4 Sets a safe execution path .IP "\(bu" 4 Checks the \s-1OS\s0 type of the running system .IP "\(bu" 4 Sets up some shell commands based on the \s-1OS\s0 type .IP "\(bu" 4 Returns its \f(CW$self\fR if it recognized the \s-1OS\s0, or undef otherwise .SH "Command Properties" .IX Header "Command Properties" These properties return unqualified command names with switches, when they appear, appropriate for the running \s-1OS\s0. (Since \fI_init()\fR sets the execution path, we do not fully qualify the paths to these commands.) .Sh "\s-1\fISUDO\s0()\fP" .IX Subsection "SUDO()" The \fIsudo\fR\|(8) command without any switches .Sh "\s-1\fIGREP\s0()\fP" .IX Subsection "GREP()" The \fIgrep\fR\|(1) command, without any switches .Sh "\s-1\fIPS\s0()\fP" .IX Subsection "PS()" The \fIps\fR\|(1) command with switches that produce a listing parseable by \fIcheckpid()\fR .Sh "\s-1\fIINITSCR\s0()\fP" .IX Subsection "INITSCR()" .Vb 1 \& The complete path to the sudoscriptd init script .Ve .Sh "\s-1\fISCRIPT\s0()\fP" .IX Subsection "SCRIPT()" The \fIscript\fR\|(1) command. On Linux, this will have the \-q switch added. .Sh "\s-1\fITZNAMES\s0()\fP" .IX Subsection "TZNAMES()" The local time zone names set up by \fI_init()\fR .SH "Methods" .IX Header "Methods" .Sh "\fIcheck_ssd()\fP" .IX Subsection "check_ssd()" This method checks to see if sudoscriptd is running (via \fIcheckpid()\fR) If not, it offers to start it, and gives some helpful advice regarding starting sudoscriptd at boot time. It also tells the user they need root sudo privilege to successfully start sudoscriptd. The method then looks for the sudoscriptd init script set up by \fI_init()\fR. If that script is not found, or is not executable, the method prompts for an init script path to use. It then attempts to start the daemon. The method sleeps for three seconds and then checks again for sudoscriptd with \fIcheckpid()\fR. If the daemon still isn't running, the method \fBdie\fRs, taking the caller with it. .Sh "\fIcheckpid()\fP" .IX Subsection "checkpid()" This method gets the \s-1PID\s0 of the current sudoscriptd out of /var/run/sudoscriptd.pid, if there is such a file. It looks for the \s-1PID\s0 in the process list If there is such a process, and its name contains 'sudoscriptd', the method returns the \s-1PID\s0. Otherwise, it returns 0. .Sh "\fIdatestamp()\fP" .IX Subsection "datestamp()" This method returns a date stamp string in one of three formats, depending on the passed parameter. .PP These are: .IP "long" 4 .IX Item "long" wdy mon dd hh:mm:ss \s-1TZ\s0 yyyy .IP "sortable" 4 .IX Item "sortable" yyyymoddhhmmss .IP "anything else" 4 .IX Item "anything else" wdy mon dd hh:mm:ss .PP .Vb 1 \& Where: .Ve .PP .Vb 9 \& wdy = week day name \& mon = three letter month name \& TZ = three letter time zone name (e.g. 'PST') \& yyyy = four digit year \& mo = two digit month number \& dd = two digit day of month \& hh = two digit hour \& mm = two digit minute \& ss = two digit second .Ve .Sh "\fIdaemon_io()\fP" .IX Subsection "daemon_io()" This method closes \s-1STDIN\s0 and \s-1STDOUT\s0, and redirects \s-1STDERR\s0 to a file named: .PP .Vb 1 \& /var/run/sudoscriptd/stderr$tag .Ve .PP Where \f(CW$tag\fR is a string passed to the method. There are commonly three, but sometimes two or four types of daemons running at all times in the sudoscript system. Each of them calls \fIdaemon_io()\fR and each gets a seperate (per daemon type) stderr log. These are are overwritten on the next sudoscriptd startup. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIsudoscript\fR\|(8) .PP \&\fIsudoscriptd\fR\|(8) .PP \&\fIsudoshell\fR\|(1) .PP \&\fIsudo\fR\|(8) .PP \&\fIsudoers\fR\|(5) .PP http://www.egbok.com/sudoscript .SH "AUTHOR" .IX Header "AUTHOR" Howard Owen, .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright 2003 by Howard Owen .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.