Sample ASU Stop Script for the kitche Service

#!/contrib/bin/perl
#
# /var/adm/ues/bin/kitche_stop_asdu.pl
#
$| = 1;

$asdu_mnt = "/usr/var/ase/mnt/kitche/usr/net";
#
# Stuff to take ASDU offline and to deport the disks
#
$asdu_stop = "/usr/net/servers/lanman/scripts/asuase_stop";

$lmx_pids = `/sbin/ps agxw | grep lmx | grep -v grep 2> /dev/null`;

if (-f "$asdu_stop" && $lmx_pids ne "") {
  print "Stopping ASDU ...\n";
  system("$asdu_stop");
}

&ck_asdu;

# Kill any processes still occupying the mount point
#
$usr_net = `/sbin/mount -t advfs | grep '/usr/net' 2> /dev/null`;
if ( "$usr_net" ) {
  print "Killing remaining processes on /usr/net ...\n";
  `/usr/sbin/fuser -ck $asdu_mnt`;
}

#
# Check for stray file-on-file mounts
#
open(FILE,"/sbin/mount |");
while() {
  chop($_);
  next unless (/file-on-file/);
  ($fof,$text1,$text2,$mount,$rest) = split(/\s+/,$_);
  `/sbin/umount -f $mount`;
}
close FILE;
print "Done.\n";

sub ck_asdu {
  while(true) {
     $ps = `/sbin/ps agx | grep lmx | grep -v grep`;
     if ($ps eq "") {
       return;
     }
     else {
       print "sleeping ...\n";
       sleep 2;
     }
  }
}