Skip to content

Instantly share code, notes, and snippets.

@pmbuko

pmbuko/u2q.pl

Last active Dec 25, 2015
Embed
What would you like to do?
#!/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