GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Sudoscript(3pm) User Contributed Perl Documentation Sudoscript(3pm)

Sudoscript.pm

 use Sudoscript;
 my $ss=Sudoscript->new();
 .. do stuff with $ss

A module to implement some common attributes and methods shared between sudoshell and sudoscriptd. See sudoscript(8), sudoscriptd(8) and sudoshell(1) for descriptions of the sudoscript system.

This module implements routines that

  • Set up the execution environment based on the running OS
  • Return command names with switches tuned for the running OS
  • Check to see if sudoscriptd is running
  • Return date stamp strings in one of several formats
  • Close standard I/O channels for daemons, redirecting STDERR to log files.

The following sections docment these routimnes more fully.

The constructor is called new(). It does the usual OO style initialization, then returns the result of calling _init();

The _init() routine:

  • Initializes the local time zone names
  • Sets a safe execution path
  • Checks the OS type of the running system
  • Sets up some shell commands based on the OS type
  • Returns its $self if it recognized the OS, or undef otherwise

These properties return unqualified command names with switches, when they appear, appropriate for the running OS. (Since _init() sets the execution path, we do not fully qualify the paths to these commands.)

SUDO()

The sudo(8) command without any switches

GREP()

The grep(1) command, without any switches

PS()

The ps(1) command with switches that produce a listing parseable by checkpid()

INITSCR()

  The complete path to the sudoscriptd init script

SCRIPT()

The script(1) command. On Linux, this will have the -q switch added.

TZNAMES()

The local time zone names set up by _init()

check_ssd()

This method checks to see if sudoscriptd is running (via checkpid()) 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 _init(). 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 checkpid(). If the daemon still isn't running, the method dies, taking the caller with it.

checkpid()

This method gets the PID of the current sudoscriptd out of /var/run/sudoscriptd.pid, if there is such a file. It looks for the PID in the process list If there is such a process, and its name contains 'sudoscriptd', the method returns the PID. Otherwise, it returns 0.

datestamp()

This method returns a date stamp string in one of three formats, depending on the passed parameter.

These are:

long
wdy mon dd hh:mm:ss TZ yyyy
sortable
yyyymoddhhmmss
anything else
wdy mon dd hh:mm:ss

 Where:

   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

daemon_io()

This method closes STDIN and STDOUT, and redirects STDERR to a file named:

  /var/run/sudoscriptd/stderr$tag

Where $tag 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 daemon_io() and each gets a seperate (per daemon type) stderr log. These are are overwritten on the next sudoscriptd startup.

sudoscript(8)

sudoscriptd(8)

sudoshell(1)

sudo(8)

sudoers(5)

http://www.egbok.com/sudoscript

Howard Owen, <hbo@egbok.com>

Copyright 2003 by Howard Owen

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2004-05-30 perl v5.8.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.