XENIX command 'haltsys' equivalent in UNIX?

Tillmann Basien tb at pemstgt.gtc.de
Mon Aug 13 04:37:29 AEST 1990


teresa at nttor.uucp (Teresa Fung) writes:

>Can someone tell me what the equivalent command in 
>UNIX SYSTEM V/68 to the XENIX OS 'haltsys' is?


>The closest command that I have found is shutdown but
>it doesn't give the user a choice to power down or
>reboot (by hitting a key).         

>Thanks in advance for the help.

	I don't know, wether I understand this question correctly. But it
	looks like the problem, that I have had on SCO XENIX 2.3.2.
	I have some users on my system, who are authorized to shutdown the
	system. I have a modified shutdown-programm called userdown. See
	below.
	This script can be started from every user, who is included in
	shutdown script.

Modify the shutdown-script in the first lines like shown below:
	set -- `who am i`
	case $1 in
	root|sysadm|<user1>|<user2>|"")	: OK			;;
	*)echo "shutdown: must run in the foreground by root or sysadm." >&2

The Programm must have the following permissions::
-rwsr-xr-x   1 root     pem        22071 Jul 04 17:50 userdown

But the programm on /usr/bin .

This is the programm
#include	<stdio.h>
#include	<errno.h>


void main()
 {

  char p[100];

  if( setuid(0) == 0 && setgid(0) ==0)
   {
    sprintf(p,"cd / ; /etc/shutdown 0 ");
    system(p);
   }
  else
    {
     perror("Can't set uid/gid");
    }
 }

-- 
Dipl.Ing. Tillmann Basien                Programmentwicklung fuer Microcomputer
Vaihinger Str.49, PostBox 810165		      +49-711-713047	FAX
7000 Stuttgart 80- West Germany                       +49-711-713045	PHONE



More information about the Comp.unix.xenix mailing list