Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rabbitmq_agents
Manage
Activity
Members
Labels
Plan
Issues
15
Issue boards
Milestones
Wiki
Code
Merge requests
8
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rc
rabbitmq_agents
Commits
5d14283c
Commit
5d14283c
authored
8 months ago
by
Bo-Chun Chen
Browse files
Options
Downloads
Patches
Plain Diff
feat: Add script to move between groups
parent
7b8c6288
No related branches found
No related tags found
1 merge request
!154
Add script to move between groups
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
user_migrate.sh
+44
-0
44 additions, 0 deletions
user_migrate.sh
with
44 additions
and
0 deletions
user_migrate.sh
0 → 100644
+
44
−
0
View file @
5d14283c
#!/bin/bash
user
=
$1
group_to
=
$2
rc
=
0
if
[[
-z
"
${
group_to
}
"
]]
;
then
echo
"Usage:
$0
USER TARGET_GROUP"
exit
1
elif
[[
"
${
group_to
}
"
!=
"gpfs4"
&&
"
${
group_to
}
"
!=
"gpfs5"
]]
;
then
echo
"Target group should be
\"
gpfs4
\"
or
\"
gpfs5
\"
, got
\"
${
group_to
}
\"
."
exit
1
fi
getent passwd
"
$user
"
>
/dev/null 2&>1
if
[[
$?
-ne
0
]]
;
then
echo
"The user
$user
does not exist"
exit
1
fi
cd
/cm/shared/rabbitmq_agents
||
exit
source
venv/bin/activate
./account_manager.py
"
$user
"
hold
if
[[
"
$group_to
"
==
"gpfs4"
]]
;
then
group_from
=
gpfs5
else
group_from
=
gpfs4
fi
if
[[
-d
"/
$group_from
/data/user/home/
$user
"
]]
;
then
rsync
-a
--delete
"/
$group_from
/data/user/home/
$user
/"
"/
$group_to
/data/user/home/
$user
"
./group_manager.py
"
$user
"
-g
"
$group_to
"
./group_manager.py
"
$user
"
-d
-g
"
$group_from
"
else
echo
User home directory does not exist.
rc
=
1
fi
./account_manager.py
"
$user
"
ok
exit
$rc
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment