Skip to content

Instantly share code, notes, and snippets.

@pmbuko
Last active December 25, 2015 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmbuko/7044914 to your computer and use it in GitHub Desktop.
Save pmbuko/7044914 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl -w
use strict;
# This script automates the process of adding usersets to the user_lists section
# of the SGE cluster queue configs. It takes the userset name as a command line
# argument or it prompts for the userset name if no argument is given. Multiple
# lists can be submitted as a comma-separated list *without spaces*.
# queues to be modified
my @queues = qw(
archive.q
gpu.q
interactive.q
new.q
old.q
short.q
);
my $input=$ARGV[0];
# If no arguments passed, print helpful info and prompt for userset name
if (! defined($input)) {
print join( "\n ", "\nThis command will add a new userset to the following cluster queues:\n" , @queues , "\n" );
# Get input from STDIN.
print "Enter the name of the new userset (or ^c to exit). Use commas *without spaces* to separate multiple lists): ";
chomp($input=<STDIN>);
}
# Add the supplied usersets to each queue using 'qconf -aattr' method
foreach my $queue (@queues) {
system("qconf -aattr queue user_lists $input $queue");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment