Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61378693
create_user.sh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, May 6, 07:26
Size
2 KB
Mime Type
text/x-shellscript
Expires
Wed, May 8, 07:26 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
17503506
Attached To
rSCCRYOSPARC scitas-cryosparc-scripts
create_user.sh
View Options
#!/bin/bash
set
-euo pipefail
# Script made from the page
# https://docs.ycrc.yale.edu/clusters-at-yale/guides/cryosparc/
script_path
=
$(
dirname
"$0"
)
# relative
script_path
=
$(
cd
"${script_path}"
&&
pwd
)
# absolutized and normalized
install_path
=
"$HOME"
/cryosparc
# set up some more paths
db_path
=
${
install_path
}
/database
worker_path
=
${
install_path
}
/cryosparc2_worker
# Usage
usage
()
{
echo
"Usage:"
echo
" -p install path : prefix for installation [${install_path}] "
echo
" -v : be verbose"
echo
" -h : print this notice"
echo
""
}
VERBOSE
=
false
read
-p
"Enter your first name: "
firstname
read
-p
"Enter your last name: "
lastname
read
-p
"Enter your email address: "
mail
read
-p
"Enter user name for the account: "
user_name
read
-p
"Enter password for the account: "
password
# Parse options
while
getopts
":p:vh"
opt;
do
case
$opt
in
p
)
install_path
=
"${OPTARG}"
;;
v
)
VERBOSE
=
true
;;
h
)
usage
OPTIND
=
1
exit
0
;;
\?
)
echo
"Invalid option: -$OPTARG"
>&2
usage
OPTIND
=
1
exit
1
;;
:
)
echo
"Option -$OPTARG requires an argument."
>&2
usage
OPTIND
=
1
exit
1
;;
esac
done
# Reset OPTIND to allow the next invocation to work
OPTIND
=
1
message
()
{
if
$VERBOSE
then
echo
"${1}"
fi
}
echo
"[Info] Starting the master if needed"
if
[
$(${
install_path
}
/cryosparc_master/bin/cryosparcm.sh status | grep -c
"CryoSPARC is not running"
)
-eq 1
]
;
then
${
install_path
}
/cryosparc_master/bin/cryosparcm.sh start
fi
#user_name=$(whoami)
#mail=$(ldapsearch -x -LLL -h scoldap.epfl.ch -b "o=epfl,c=ch" uid=${user_name} mail | grep mail | awk '{ print $2 }')
#firstname=$(ldapsearch -x -LLL -h scoldap.epfl.ch -b "o=epfl,c=ch" uid=${user_name} givenName | grep givenName | awk '{ print $2 }')
#lastname=$(ldapsearch -x -LLL -h scoldap.epfl.ch -b "o=epfl,c=ch" uid=${user_name} sn | grep sn | awk '{ print $2 }')
if
[
"x$password"
!
=
"x"
]
;
then
${
install_path
}
/cryosparc_master/bin/cryosparcm.sh createuser --email
"${mail}"
--firstname
"${firstname}"
--lastname
"${lastname}"
--username
"${user_name}"
--password
"${password}"
fi
#${install_path}/cryosparc_master/bin/cryosparcm.sh stop
Event Timeline
Log In to Comment