| oct2005.tar |
Listing 10 srm_user2project - An example script to dynamically move the processes owned by a user into a project
#!/usr/perl5/5.6.1/bin/perl
use strict;
use warnings;
my $user=$ARGV[0] || die "Please specify a user\n";
my $project=$ARGV[1] || "user.$user";
my $pid;
open(LIST,"ps -u $user -o pid |");
while(<LIST>){
next if /PID/;
chomp;
$pid=$_;
print "Moving process $pid to project $project...\n";
system("newtask -v -p $project -c $pid");
}
close(LIST);
|