-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathiocData_setup.sh
More file actions
executable file
·39 lines (37 loc) · 1.45 KB
/
iocData_setup.sh
File metadata and controls
executable file
·39 lines (37 loc) · 1.45 KB
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
#!/bin/sh
IOC_HOST=`$IOC_COMMON/All/get_hostname.sh | tail -1`
if [ "$IOC_USER" == "" ]; then
echo Warning: Set IOC_USER env variable in your startup.cmd file before running common_env.sh
else
# Run processes as the correct IOC userid
if [ -f /sbin/runuser ]; then
export RUNUSER="/sbin/runuser $IOC_USER -s /bin/bash --preserve-environment -c"
else
export RUNUSER="su $IOC_USER -c"
fi
# Make sure the host iocData directory exists for the caRepeater log
if [ ! -d $IOC_DATA/$IOC_HOST ]; then
$RUNUSER "mkdir $IOC_DATA/$IOC_HOST"
if [ -n "$(which setfacl)" ]; then
$RUNUSER "setfacl -d -m group:ps-ioc:rwx $IOC_DATA/$IOC_HOST"
$RUNUSER "setfacl -m group:ps-ioc:rwx $IOC_DATA/$IOC_HOST"
fi
$RUNUSER "mkdir -p $IOC_DATA/$IOC_HOST/iocInfo"
$RUNUSER "mkdir -p $IOC_DATA/$IOC_HOST/logs"
fi
# Make sure the soft ioc iocData directories exist and have the right permissions
if [ "$IOC" == "" ]; then
echo Warning: Set IOC env variable in your startup.cmd file before running common_env.sh
elif [ ! -d $IOC_DATA/$IOC ]; then
$RUNUSER "mkdir $IOC_DATA/$IOC"
if [ -n "$(which setfacl)" ]; then
$RUNUSER "setfacl -d -m group:ps-ioc:rwx $IOC_DATA/$IOC"
$RUNUSER "setfacl -m group:ps-ioc:rwx $IOC_DATA/$IOC"
fi
$RUNUSER "mkdir -p $IOC_DATA/$IOC/autosave"
$RUNUSER "mkdir -p $IOC_DATA/$IOC/archive"
$RUNUSER "mkdir -p $IOC_DATA/$IOC/iocInfo"
$RUNUSER "mkdir -p $IOC_DATA/$IOC/logs"
$RUNUSER "chmod ug+w -R $IOC_DATA/$IOC"
fi
fi