FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
developer-scripts/linux_setup.sh at master · chenchix/developer-scripts · GitHub
chenchix
/
developer-scripts
Public
forked from
edgexfoundry/developer-scripts
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
developer-scripts
/
linux_setup.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
133 lines (113 loc) · 3.52 KB
Breadcrumbs
developer-scripts
/
linux_setup.sh
Copy path
File metadata and controls
executable file
·
133 lines (113 loc) · 3.52 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!
/bin/bash
#
################################################################################
#
Copyright 2017 Dell Inc.
#
Chad Young <chad.young@dell.com>
#
#
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
#
in compliance with the License. You may obtain a copy of the License at
#
#
http://www.apache.org/licenses/LICENSE-2.0
#
#
Unless required by applicable law or agreed to in writing, software distributed under the License
#
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
#
or implied. See the License for the specific language governing permissions and limitations under
#
the License.
#
#
################################################################################
#
The user must define this path
#
Full path
dbpath=
"
/home/tester/edgex/db
"
#
Short path - no"/db/"
dirname=
"
/home/tester/edgex
"
clear
echo
echo
"
This script will do the following:
"
echo
"
-- Ask you to supply a user name (consider
\"
<user>
\"
in /home/<user>)
"
echo
"
---- The username is needed to set folder ownership.
"
echo
"
---- This username will not be the same username used for mongodb.
"
echo
"
---- The mongodb username will be supplied in the init_mongo.js file.
"
echo
"
-- Create folders, if necessary, for the database.
"
echo
"
-- Start database creation (without --auth).
"
echo
"
-- Initialize the database for Edgex.
"
echo
"
-- Shutdown the database.
"
echo
"
-- Verify all processes of Mongo are stopped.
"
echo
"
-- Start the database again (using --auth).
"
echo
echo
#
Confirm the database folder location
echo
"
Should the folder for the database be created here:
$dbpath
"
echo
echo
"
Choose a number for your answer
"
select
yn
in
"
Yes
"
"
No
"
;
do
case
$yn
in
Yes )
break
;;
No )
echo
;
echo
"
Program exit. Edit the top of this shell file and run again
"
;
exit
;;
esac
done
#
Ask for a user name
echo
echo
"
What is the non-root user name who will own the folders where the database will be stored:
"
echo
#
read the non-root user name
read
name
echo
#
Confirm the user name
echo
"
Is this what you meant to write:
$name
"
echo
echo
"
Choose a number for your answer
"
select
yn
in
"
Yes
"
"
No
"
;
do
case
$yn
in
Yes )
break
;;
No )
echo
;
echo
"
progam exit, rerun again
"
;
exit
;;
esac
done
#
folder creation and change ownership
echo
"
Checking to see if
$dbpath
exist?
"
echo
if
[
!
-d
$dbpath
]
then
echo
echo
"
The folder doesn't exist.
"
echo
echo
"
Now creating
$dbpath
"
sudo mkdir -p
$dbpath
echo
echo
"
Folder created
"
echo
#
DEBUG
#
echo "Who is the owner of the folder"
#
OWNS=$(stat -c '%U' $dbpath)
#
echo $OWNS
#
echo
echo
"
Changing the file owner to
$name
"
sudo chown -R
$name
:
$name
$dirname
echo
echo
"
File owner changed
"
echo
#
DEBUG
#
echo "Who is the owner of the folder"
#
OWNS=$(stat -c '%U' $dbpath)
#
echo $OWNS
#
echo
echo
"
Folder creation is complete, moving to next step
"
echo
else
echo
"
File exists -> moving to next step
"
echo
fi
#
Start the database creation (without --auth)
sudo mongod --dbpath
$dbpath
echo
#
Initialize the database for edgex
sudo mongo
<
init_mongo.js
echo
#
Shutdown the database
sudo mongod --dbpath
$dbpath
--shutdown
echo
#
Verify all the processes of Mongo are stopped
killpid=
`
sudo netstat -ntlp
|
grep mongod
|
awk
'
{print $7}
'
|
sed
'
s/\/.*//
'
`
#
echo This is the pid that needs to die: $killpid
sudo
kill
-9
$killpid
sudo netstat -tulnp
|
grep mongod
#
Start the database (using --auth)
sudo mongod --dbpath
$dbpath
--auth
Back
|
FazBrowse Home
|
New Git URL