You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
590 B
Bash
22 lines
590 B
Bash
pm2 stop mongodb
|
|
rm -rf /data/db /data/file
|
|
mkdir /data/db /data/file
|
|
pm2 start mongod
|
|
sleep 3
|
|
db_password=$(cat /dev/urandom | head -n 10 | md5sum | head -c 20)
|
|
echo "db.createUser({
|
|
user: 'hydro',
|
|
pwd: '$db_password',
|
|
roles: [
|
|
{ role: 'readWrite', db: 'hydro' }
|
|
]
|
|
})" >/tmp/createUser.js
|
|
mongo 127.0.0.1:27017/hydro /tmp/createUser.js
|
|
echo "{\"host\":\"127.0.0.1\",\"port\":\"27017\",\"name\":\"hydro\",\"username\":\"hydro\",\"password\":\"$db_password\"}" >~/.hydro/config.json
|
|
pm2 stop mongod
|
|
pm2 del mongod
|
|
pm2 restart minio
|
|
pm2 start mongodb
|
|
pm2 restart hydrooj
|
|
pm2 save
|