Il 12/02/2016 10:59, Diego Zuccato ha scritto:

> Probably it could be better to add an
> echo 'print Cancelled for insufficient privilege'
> just before scancel, but I've not tested it.
Tested and it does not work. So I simplified the script a bit more:
--8<--
#!/bin/bash
allowonly()
{
    # "getent groups" does not recurse :(
    /usr/bin/id $SLURM_JOBUSER | /bin/grep -qi $1 || (
        /usr/bin/scancel $SLURM_JOBID
    )
}

case "$SLURM_JOB_PARTITION" in
    hpc_inf|hpc_large)
        allowonly Str957-bl0-abilitati-baldi
        ;;
esac
--8<--

This way it can easily be extended to different groups for different
partitions. Moreover, when "public" partition is requested there's no
'id' overhead (as I said, on my frontend it could take up to about 10
seconds!).

-- 
Diego Zuccato
Servizi Informatici
Dip. di Fisica e Astronomia (DIFA) - Università di Bologna
V.le Berti-Pichat 6/2 - 40127 Bologna - Italy
tel.: +39 051 20 95786
mail: [email protected]

Reply via email to