-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgreeneUsers.lua
More file actions
46 lines (35 loc) · 866 Bytes
/
greeneUsers.lua
File metadata and controls
46 lines (35 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/env lua
local greeneUsers = {}
local greeneUtils = require "greeneUtils"
local greeneSpecialUsers = require "greeneSpecialUsers"
local slurm_log = greeneUtils.slurm_log
local user_log = greeneUtils.user_log
local users = { }
users["0"] = "root"
users["10015"] = "wang"
local netid = nil
local function uid_to_netid(uid)
local uid = string.format("%d", uid)
netid = users[uid]
if netid == nil then
print("To run: id -nu " .. uid)
local out = io.popen("id -nu " .. uid)
netid = out:read()
out.close()
users[uid] = netid
end
end
local function uid_is_valid(uid)
uid_to_netid(uid)
if netid == nil then
user_log("uid %d is not valid to run jobs", uid)
return false
end
return true
end
-- functions
slurm_log("To load greeneUsers.lua")
return greeneUsers
--[[
to check CGSB users
--]]